SPUG: Current tutorial/reference on Signals?

Tim Maher tim at consultix-inc.com
Wed Oct 18 11:27:44 PDT 2006


Every once in a while I have a need to make use of Perl signals again
in my work, and it's always a frustrating experience, due to the
historical differences between Perl versions themselves, and also
differences in how they can behave on Sys-V vs. BSD platforms--among
other complications.

Of course, given recent changes in the way Perl's signaling
system works, all the standard documentation on signals seems to
be out of date to various degrees (the 2000 Camel; the 2001
Network Programming with Perl, man perlipc, etc.), as are all the
on-line tutorials I've seen.

So it's hard to predict whether a "legacy" program or an example from
one of these classic tomes will actually work properly on one platform
consisting of a given Perl version and an OS, let alone on more varied

Using Sys::SigAction for setting all signal handlers and timeouts
would seem to have the potential for making these tools both reliable
and portable, but I've glanced through the module's code and I haven't
seen much going on in there, so I wonder how intelligent this module
really is.

I'm left wondering whether the "state of the art" in Perl signal
handling might still be one that would lead to messy rules such as:

    "Always use Sys::SigAction's set_sig_handler() to assign a
    handler, but only use the SA_RESTART option with Perl versions
    W->X on UNIX or versions Y->Z on Linux, unless you might be
    interrupting system call N, in which case leave out the
    SA_RESTART altogether, and just cross your fingers".

But maybe I'm just being paranoid 8-{ 

Can somebody offer some guidelines, or "Best Practices", or actual
documentation, on how to use Perl signals reliably and portably with
the 5.8.* versions of Perl?

|  Tim Maher, PhD  (206) 781-UNIX   (866) DOC-PERL  (866) DOC-UNIX  |
|  tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com    |
| UPCOMING CLASSES;  11/6: Minimal Perl  11/8-10: Intermediate Perl |
|  * Check out my new book: "Minimal Perl for UNIX/Linux People" *  |
|    See MinimalPerl.com for details, free chapters, and ordering   |

More information about the spug-list mailing list