Skip to content

Instantly share code, notes, and snippets.

@typester
Created August 2, 2011 08:39
Show Gist options
  • Save typester/1119826 to your computer and use it in GitHub Desktop.
Save typester/1119826 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use 5.010000;
use AE;
use AnyEvent::HTTP;
my @urls = (
'http://www.google.co.jp',
'http://www.yahoo.co.jp',
);
local $AnyEvent::HTTP::MAX_PER_HOST = 5;
my $cv = AE::cv();
for my $url (@urls) {
$cv->begin;
http_get $url, sub {
my $data = shift;
print "##### $url #####\n" . $data . "\n";
$cv->end
};
}
$cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment