in reply to How do we capture CTRL^C

One thing to note is that on some systems, signal(3) function is broken.(Perl uses this for its signal-handling mechanism, and perldoc says that on some systems, it behaves in <q>the old unreliable SysV way. </q>

In this case, you need to re-register the signal inside the handler itself.

I bring this to your notice coz some time ago, I was much troubled by this behaviour(dont remember, probably ActivePerl.....) and found this in perldoc after much brain-racking.....

Because Perl's signal mechanism is currently based on the signal(3) function from the C library, you may sometimes be so misfortunate as to run on systems where that function is "broken", that is, it behaves in the old unreliable SysV way rather than the newer, more reasonable BSD and POSIX fashion. So you'll see defensive people writing signal handlers like this:
sub REAPER { $waitedpid = wait; # loathe sysV: it makes us not only reinstate # the handler, but place it after the wait $SIG{CHLD} = \&REAPER; } $SIG{CHLD} = \&REAPER; # now do something that forks...


Manav