Greetings
I am attempting to use the timeout function of LWP::UserAgent. The following code is straight from the documentation yet I can not successfully utilize the timeout. I am attempting to access an unreachable address,
and if nothing is returned within a set amount of time (less than the default of three minutes), I would like the process to stop attempting to reach (what will be ovbiously) an unreachable host.
Guidence would be appreciated
#! /usr/bin/perl
use Crypt::SSLeay;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('https://66.11.78.112');
#this timeout statement is not effective
$ua->timeout(3);
if ($response->is_success) {
print $response->content; # or whatever
}
else {
die printf " %s\n", $response->status_line;
}