This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.14.2; | |
use Benchmark qw(timethese cmpthese); | |
use HTML::TreeBuilder; | |
use Mojo::UserAgent; | |
use Mojo::DOM; | |
my $url = 'http://www.i-can.eu/index.html'; | |
my $content = Mojo::UserAgent->new->get($url)->res->body; | |
#PARSING SPEED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#Mojo::DOM and Mojo::UserAgent just rock, but sometimes you are not allowed to use them. | |
use 5.14.2; | |
use HTML::TreeBuilder; | |
my $url = 'http://contao.org/en/extension-list/view/i18nl10n.html'; | |
my $root = HTML::TreeBuilder->new_from_url($url); | |
$root->eof(); # done parsing for this tree | |
my $h1 = $root->find_by_tag_name('h1'); | |
say $h1->as_trimmed_text; #h1 |
NewerOlder