Am I misunderstanding the $ua->timeout() method of LWP UserAgent? the www.richard.com in the list doesnt return but doesnt timeout either even if set to 10 seconds.
Is there a way to stop this, short of terminating the request myself??
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
print "Timeout : ", $ua->timeout, "\n";
$ua->timeout(10);
print "Timeout : ", $ua->timeout, "\n";
my %urls = ('http://www.hotmail.com', '',
'http://www.richard.com', '',
'http://www.slashdot.org', '',
'http://doesnt.exist.com/', '',
'http://www-uk.cricket.org/', '');
are_live(keys %urls);
sub are_live {
for (@_) {
$ua->timeout('5');
my $res = $ua->request(HTTP::Request->new(GET => $_));
$urls{$_} = ($res->is_success) ? "OK" : "NOT OK";
}
}
for (keys %urls) {
print "URL : $_ : $urls{$_} \n";
}