agoth has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP - timeout
by arhuman (Vicar) on Jan 26, 2001 at 16:42 UTC | |
|
Re: LWP - timeout
by Rune (Initiate) on Jan 26, 2001 at 19:33 UTC | |
|
Re: LWP - timeout (out of luck on Win32)
by dws (Chancellor) on Jan 26, 2001 at 23:03 UTC | |
by MeowChow (Vicar) on Jan 27, 2001 at 00:22 UTC | |
by agoth (Chaplain) on Jan 29, 2001 at 14:35 UTC |