Skip to content

Instantly share code, notes, and snippets.

@gfx
Created November 6, 2010 15:38
Embed
What would you like to do?
#!perl -w
# usage: fetch.pl [urls...]
use strict;
use Coro;
use Coro::Select; # この行をコメントアウトすると多重化されなくなり時間がかかるようになる
use Furl;
my @coros;
foreach my $url(@ARGV) {
push @coros, async {
print "fetching $url\n";
my $furl = Furl->new();
my $res = $furl->head($url);
print "$url: ", $res->status_line, "\n";
};
}
$_->join for @coros;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment