in reply to Do's and Dont's inside a signal handler

Well, it depends. Are you running with safe signals or not? Safe signals were introduced early in the 5.8.x series. It basically means that delivery of a signal is delayed till the next "op" - which means that when the handler is run, the perl internals are in a consistent state. It's, from a perl POV, safe to do almost anything. The disadvantage is that the signal may arrive during a long running system call, which means it may take a long time for your signal to be handled. Unsafe signals, the old default, were delivered immediately. From a C POV (and since perl is written in C, this is important), you can only do a handful of things safely; you shouldn't call non-reentrant function, and, importantly, you shouldn't malloc memory. Unfortunally, almost anything you do in Perl may cause perl to malloc memory (including looking at a variable).
  • Comment on Re: Do's and Dont's inside a signal handler