![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
LWP Timeout and Alarm handlingby daviddhall (Sexton) |
on Aug 24, 2001 at 03:17 UTC ( [id://107542]=perlquestion: print w/replies, xml ) | Need Help?? |
daviddhall has asked for the wisdom of the Perl Monks concerning the following question:
Ok, I've looked at the random bits of coded suggestions people have posted for handling http timeouts and unreachable servers. And am still a bit confused. I have a script I've written to grab a bunch of urls from a server; however, every so often something chokes (I'm presuming on the server side) and my code just sits there trying to grab the page without ever returning. So, I was investigating the LWP::UserAgent timeout settings and it didn't seem to work (never times out) for this particular problem. I'm presuming that the server is basically giving some sort of error similar to the richard.com delima. But I don't know exactly and don't know how to figure it out. So, I'm trying to hardcode a timeout so that it will try the url again after a certain amount of seconds since I'm pretty sure the server is available and should return a response. The code below seems to work but looks kinda sloppy. Is there a better way to do all this? (I'm using LWP::Simple to keep things simple but could use whatever) Thanks in advance for your help!
Back to
Seekers of Perl Wisdom
|
|