#!/usr/bin/perl use strict; use warnings; use Benchmark::Forking qw( timethis timethese cmpthese ); use Web::Scraper; $| = 1; $\ = "\n"; # hier fehlt der HTML-Code von einem Google-Suchergebniss, # den ich entfernen musste, weil er über 25000 Zeichen lang war # pro Post sind ja nur maximal 10000 Zeichen erlaubt # (" und @ muss im HTML-Code entsprechend ersetzt werden) my $resp_body = ""; timethese(1000, { 'Regex' => sub { my @URLs = $resp_body =~ /

/g; }, 'WebScraper - css' => sub { my $google = scraper{ process 'a.l' => 'Links[]' => '@href' }; my $res = $google->scrape( \$resp_body ); }, 'WebScraper - XPath' => sub { my $google = scraper{ process '//a[@class="l"]' => 'Links[]' => '@href' }; my $res = $google->scrape( \$resp_body ); }, });