What's wrong with the built-in timeout?
#! perl -slw use strict; use Time::HiRes qw[ time ]; use LWP; my $ua = LWP::UserAgent->new; $ua->timeout( 0.1 ); print time; my $response = $ua->get('http://192.168.1.31/noexist.html'); print time; if ($response->is_success) { print $response->decoded_content; # or whatever } else { die $response->status_line; } __END__ C:\test>junk76 1301504675.567 1301504675.74173 500 Can't connect to 192.168.1.31:80 (connect: timeout) at C:\test\jun +k76.pl line 17.
In reply to Re: Hard timeout for LWP::UserAgent or similar
by BrowserUk
in thread Hard timeout for LWP::UserAgent or similar
by camelobserver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |