Created
April 2, 2012 13:56
-
-
Save tadzik/2283587 to your computer and use it in GitHub Desktop.
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
┌─[tadzik@yavin4]─[~/src/perl/MuEvent] (master)* | |
└─[%]─> cat http-test.pl | |
use MuEvent; | |
BEGIN { @*INC.push('lib') } | |
my $starttime; | |
my $count = 5; | |
sub handler ($content) { | |
$content ~~ / '<title>' (<-[<]>*) '</title>' /; | |
say "Received something: '$0', after {now - $starttime}"; | |
unless --$count { exit 0 } | |
} | |
http_get(url => "kosciol-spaghetti.pl", cb => &handler); | |
http_get(url => "perlcabal.org", cb => &handler); | |
http_get(url => "duckduckgo.com", cb => &handler); | |
http_get(url => "perl6.org", cb => &handler); | |
http_get(url => "www.cpan.org", cb => &handler); | |
$starttime = now; | |
MuEvent::run;; | |
┌─[tadzik@yavin4]─[~/src/perl/MuEvent] (master)* | |
└─[%]─> perl6 http-test.pl | |
Received something: 'Perl6 Community Development Server', after 0.0262637470467909 | |
Received something: 'DuckDuckGo', after 0.0412835261535518 | |
Received something: 'Perl 6', after 0.0577952229174045 | |
Received something: 'POLSKI KOÅCIÃÅ LATAJÄCEGO POTWORA SPAGHETTI | Strona oficjalna pod patronatem Bobby`ego Hendersona | FSM', after 0.259508519875679 | |
Received something: 'The Comprehensive Perl Archive Network - www.cpan.org', after 2.91935875559986 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment