in reply to signal handling

I played around a little with this on my Windows machine (Vista) at work, and my Linux machine at home. I think there's just a difference in how the two OS interpret what "Ctrl-C" means.

In the Linux case, hitting Ctrl-C sends the INT signal to the child process you forked using system. That signal is handled by the default handler, which means the child process terminates. Control passes back to the parent normally. The signal handler in the parent doesn't come into play. However, if you checked $? or the system call return value, you'd see that the child had exited with a signal.

In the Windows case, things start out the same way. The signal is sent to the child (I checked), but it it appears that if there's no signal handler in the child, the signal is sent to the parent instead. Whether this is a Perl or a Windows thing, I can't tell. In any case, I think the Linux behavior is more sane.

If you want to handle both OS, why don't you just install a signal handler in the child? That'll behave the same in both cases. Alternatively, if you're OK with letting the child terminate, but want to know what happened when control returns to the parent, just check $? for the details:

system("perl"); my $exit_code = $? >> 8; my $exit_signal = $? & 127;
(see perlvar)