Tom Pollard wrote:

> The use of an alarm to timeout an eval{} block definitely works.  I don't
> know why it works, but it does.  I do get the impression that alarms are
> handled in some special way by perl, because this idiom works on all
> platforms we've tried it on (Linux, AIX, IRIX, MacOSX, Windows), even
> though ordinary signal delivery to a threaded app isn't predictable (that
> is, which thread gets the signal?) on some of those platforms.

I just ran a little test using LWP to get a URL and having the CGI script
do a 10 second delay while I did a 5 second alarm eval.  The timer failed
to timeout until after the LWP timeout and then the strangest part was
the result returned from the LWP request came back with the alarm die code
in it:

eval {
        $SIG{ALRM} = sub { die "5 second alarm went off" };
        alarm 5;
        do_url ();      # do an LWP request that takes 10 seconds
        alarm 0;
};

Part of the response object dump:

  '_content' => '500 5 second alarm went off
',
  '_msg' => '5 second alarm went off',
  '_rc' => 500,

Very strange indeed.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to