in reply to Implementing the counterpart of BEGIN

There's no way you can get the reason for a signal by trapping it. A signal is a 1 bit message, just saying "there's a signal". (Or 6 (or some other number depending on your OS) bits, if you consider the signal number to be part of the message). There's no room for any more information. No reason. Not even who send you the signal.

You can trap each individual signal (well, except SIGSTOP and SIGKILL) though (use %SIG), so you can log which signal arrived.

  • Comment on Re: Implementing the counterpart of BEGIN