Skip to content

Instantly share code, notes, and snippets.

@gfx
Created November 6, 2010 15:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfx/665488 to your computer and use it in GitHub Desktop.
Save gfx/665488 to your computer and use it in GitHub Desktop.
#!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