问题
I'm creating a user agent using LWP::UserAgent. I want to timeout $ua->request()
. how can I do that?
my $ua = LWP::UserAgent->new();
my $request = HTTP::Request->new(DELETE => $url);
$req->authorization_basic($user, $pwd);
my $response = $ua->request($req);
I know LWP has time out, but according to the documentation
The requests is aborted if no activity on the connection to the server is observed for timeout seconds. This means that the time it takes for the complete transaction and the request() method to actually return might be longer.
来源:https://stackoverflow.com/questions/34793425/timeout-for-lwp-request