in reply to
check multiple URLS in the same time
Here is an example using AnyEvent:
#!/usr/bin/perl
use strict;
use AnyEvent;
use AnyEvent::HTTP;
my %urls = ('drudge'=> 'http://www.drudgereport.com',
'rush' =>'http://www.rushlimbaugh.com/home/today.guest.html',
'yahoo' => 'http://www.yahoo.com',
'cds' => 'http://www.cdsllc.com/',);
my $done = AnyEvent->condvar;
my @requests;
my $count;
for my $myURL (sort(values(%urls))){
$done->begin();
$count++;
print "Count is $count\n";
push @requests, http_get $myURL => sub {
print "Retrieved '$myURL' $_[1]->{Status}\n";
# $_[0] is data
# $_[1] is headers
$done->end;
};
}
print "Waiting on requests\n";
$done->recv;