Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: LWP Timouts

by virtualsue (Vicar)
on Oct 31, 2005 at 12:07 UTC ( #504231=note: print w/replies, xml ) Need Help??


in reply to LWP Timouts

Read perldoc -f alarm if you haven't already.

A quick way to do what you want:

$MyRequest = HTTP::Request->new('GET',"$URL"); alarm 30; $MyResponse = $UserAgent->request($MyRequest); my $timeleft = alarm 0;
Caveats: Too many to list in this space, signal handling has the ability to wildly complicate your life, etc. If your program is very simple I think the above may do what you need. If not, Super Search for examples and ask more questions. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504231]
help
Chatterbox?
[ambrus]: though it's very C-like (serious use of varargs so easy to pass the wrong type), and there are some minor problems (busy loop because it doesn't use the same timer as your event loop, so you have to artificially delay timer callbacks by a small amount).

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2016-12-07 16:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.