in reply to LWP::UserAgent timeout
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: LWP::UserAgent timeout
by markong (Pilgrim) on Dec 17, 2018 at 14:09 UTC | |
by IB2017 (Pilgrim) on Dec 17, 2018 at 17:42 UTC | |
by tybalt89 (Monsignor) on Dec 17, 2018 at 22:36 UTC | |
by markong (Pilgrim) on Dec 17, 2018 at 21:39 UTC | |
by bliako (Abbot) on Dec 18, 2018 at 00:57 UTC | |
|
Re^2: LWP::UserAgent timeout
by IB2017 (Pilgrim) on Dec 17, 2018 at 13:48 UTC |