Marc Langheinrich <[EMAIL PROTECTED]> writes:

> > Will this work?  I don't think so.  I am told that LWP's own alarm will
> > overrule mine, so that this will not work at all.
> The recent LWP modules should not use any "alarm()" anymore (nor does PUA),
> for exactly those reasons (i.e. not to interfere with custom alarms).

It is true that LWP does not use alarm, but the lower level IO::Socket
as distributed by perl5.004 and perl5.005_03 use it when connect()ing.
Upgrading to IO-1.20 let you use alarm() for your own purpose.  Be
aware that perl can't really catch the ALRM signal (or any signal for
that matter) safely.

Regards,
Gisle

> Instead, you can specify if you want to have LWP (or PUA) handle "die"s or
> if you'd rather do this yourself:
> 
>   $ua->use_eval(1); # catch die's for me (this is the default)
> 
> This way, you could for example set an alarm before you call $ua->request
> and then have your program die() in your SIGARLM subroutine. Since LWP will
> catch those dies, you'll get a nice response object containing the text of
> your die() (like "Custom timeout after 30 seconds").

Reply via email to