1. LWP::UserAgent's default timeout is 180 seconds.
2. You set the timeout of your UserAgent AFTER you made the request. Obviously, it has no effect for the previous request ... (maybe use LWP::UserAgent::Pscychic for such cases? - just a joke :) )
3. Your GUI app is bound to freeze while conducting the server for long or short time. HTTP::Async can help you here, it will spawn a request in the background and when you are ready, you check if it has borne any fruits, like so (mostly borrowed from the manpage):
use strict; use warnings; use HTTP::Async; use HTTP::Request; my $url = ...; my $async = HTTP::Async->new; $async->add(HTTP::Request->new(GET => $url)); while ( $async->not_empty ) { if ( my $response = $async->next_response ) { # we have a reply from server or timeout # deal with $response } else { # still waiting for a response from server, # so do something else } }
bw, bliako
In reply to Re: LWP::UserAgent timeout
by bliako
in thread LWP::UserAgent timeout
by IB2017
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |