Timeout Handling (Re: WWW::HTTP )
Martijn Koster (m.koster@nexor.co.uk)
Wed, 17 May 1995 21:27:57 +0100
I was lwp'ing again, and got back to alarms... I want a neat
solution to timeout:
$_ = <$socket>;
so I can generate a proper local timeout response. Ideally I'd
like a CATCH: label further down, or I'll settly for having
the read being interrupted with an error no.
The way I did it was to eval beforehand, and just die in the signal
handler.
I think we left it with Tim wondering if it was safe to die in a
signal handler, and Andreas suggested allowing the user to override
error handling, using MI.
The problem with Andreas' suggestion is that it doesn't help me
recover: Either the user says "fine", and it'll sit there forever,
or they have no choice but to die. At least with an eval I can
recover.
I could use select, and read the chunks in by hand and load them into
lines, but that seems rather a lot of ugly work for Perl's
reputation :-).
So, are there any better solutions? Tim, have you got any more info of
dying in a signal handler being unsafe?
-- Martijn
__________
Internet: m.koster@nexor.co.uk
X-400: C=GB; A= ; P=Nexor; O=Nexor; S=koster; I=M
WWW: http://web.nexor.co.uk/mak/mak.html