I am using LWP to download content from web pages, and I would like to limit the amount of time it waits for a page.
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$response = $ua->get("http://XML File");
$content = $response->decoded_content;
The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never succeed. Since the server thinks it is live, it keeps the socket connection open thus LWP::UserAgent's timeout value does us no good what-so-ever. What is the best way to enforce an absolute timeout on a request?
Whenever the timeout reaches its limit, it just dies and I can't continue on with the script! This whole script is in a loop, where it has to fetch XML files sequentially. I'd really like to handle this timeout properly and make the script continue to next address. Does anyone know how to do this? Thanks!!