[Catalyst] RFC: C::P::Alarm (was Re: timeouts)

Peter Karman peter at peknet.com
Fri May 5 03:16:04 CEST 2006

Nilson Santos Figueiredo Junior scribbled on 5/4/06 3:41 PM:
> On 5/4/06, Peter Karman <peter at peknet.com> wrote:
>> Comments & patches welcome.
> Unfortunately, Sys::SygAction doesn't work under Win32.
> Wouldn't alarm() suffice instead of having this dependency? alarm()
> seems to work alright as of AS Perl 5.8.8 build 816.

It's not alarm() that's the issue, iirc. C::P::Alarm uses the CORE 
alarm() function. I see that I wasn't clear enough about that in the 
BUGS section of the pod.

I believe it has to do with how win32 systems deal with sig alerts in 
general -- that is, not well.

 From the Perl Win32 doc (http://perldoc.perl.org/perlwin32.html):

Signal handling may not behave as on Unix platforms (where it doesn't 
exactly "behave", either :). For instance, calling die() or exit() from 
signal handlers will cause an exception, since most implementations of 
signal()  on Win32 are severely crippled. Thus, signals may work only 
for simple things like setting a flag variable in the handler. Using 
signals under this port should currently be considered unsupported.

That said, the Alarm plugin tries to only do "simple things" so it might 

I would be willing to include a win32-specific check to avoid using 
Sys::SigAction on those systems. Instead, I could use the straight up 
$SIG{ALRM} syntax (which is what Yuval originally posted on this topic).

Of course, I would need a win32 user like yourself to test. :)

What's the currently preferred way of testing for OS platform these 
days? Is it still just $^O  ?

Peter Karman  .  http://peknet.com/  .  peter at peknet.com

More information about the Catalyst mailing list