in reply to Possible to write a sub that times out???

If you're using LWP to connect to your web service you can use the LWP::UserAgent->timeout() method to set the timeout time (see perldoc LWP::UserAgent for more details).

This won't work very well if the web service returns parts of the page at a time though, because the request will only time out if no activity at all takes place on the connection for the specified period. So if you've specified a timeout of 60 seconds and the service keeps returning bits with 30 or 40 seconds pause in between the request will not time out and can go on for significantly longer than a minute.


A computer is a state machine. Threads are for people who cant program state machines. -- Alan Cox

Replies are listed 'Best First'.
Re^2: Possible to write a sub that times out???
by jhourcle (Prior) on Dec 25, 2005 at 12:31 UTC