X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsigtrap.pm;h=c081123b6b4ca2288221241797395ae5543da173;hb=d742c382eed38a7010c93d369ad6896d826c21d6;hp=378ca899a007b17fd134e964465b4c896c9d7267;hpb=84dc3c4daae48410e767ac41da148ac5c6c45446;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/sigtrap.pm b/lib/sigtrap.pm index 378ca89..c081123 100644 --- a/lib/sigtrap.pm +++ b/lib/sigtrap.pm @@ -8,7 +8,7 @@ sigtrap - Perl pragma to enable simple signal handling use Carp; -$VERSION = 1.01; +$VERSION = 1.02; $Verbose ||= 0; sub import { @@ -29,13 +29,16 @@ sub import { } } elsif ($_ eq 'normal-signals') { - unshift @_, qw(HUP INT PIPE TERM); + unshift @_, grep(exists $SIG{$_}, qw(HUP INT PIPE TERM)); } elsif ($_ eq 'error-signals') { - unshift @_, qw(ABRT BUS EMT FPE ILL QUIT SEGV SYS TRAP); + unshift @_, grep(exists $SIG{$_}, + qw(ABRT BUS EMT FPE ILL QUIT SEGV SYS TRAP)); } elsif ($_ eq 'old-interface-signals') { - unshift @_, qw(ABRT BUS EMT FPE ILL PIPE QUIT SEGV SYS TERM TRAP); + unshift @_, + grep(exists $SIG{$_}, + qw(ABRT BUS EMT FPE ILL PIPE QUIT SEGV SYS TERM TRAP)); } elsif ($_ eq 'stack-trace') { $handler = \&handler_traceback; @@ -164,9 +167,9 @@ installed signals. =item B -The handler used for subsequently installed signals will output a Perl -stack trace to STDERR and then tries to dump core. This is the default -signal handler. +The handler used for subsequently installed signals outputs a Perl stack +trace to STDERR and then tries to dump core. This is the default signal +handler. =item B @@ -183,7 +186,7 @@ assignment to an element of C<%SIG>. =head2 SIGNAL LISTS -B has two built-in lists of signals to trap. They are: +B has a few built-in lists of signals to trap. They are: =over 4 @@ -204,17 +207,22 @@ QUIT, SEGV, SYS and TRAP. These are the signals which were trapped by default by the old B interface, they are ABRT, BUS, EMT, FPE, ILL, PIPE, QUIT, SEGV, SYS, TERM, and TRAP. If no signals or signals lists are passed to -B this list is used. +B, this list is used. =back +For each of these three lists, the collection of signals set to be +trapped is checked before trapping; if your architecture does not +implement a particular signal, it will not be trapped but rather +silently ignored. + =head2 OTHER =over 4 =item B -This token tells B only to install handlers for subsequently +This token tells B to install handlers only for subsequently listed signals which aren't already trapped or ignored. =item B @@ -224,9 +232,9 @@ listed signals. This is the default behavior. =item I -Any argument which looks like a signals name (that is, -C) is taken as a signal name and indicates that -B should install a handler for it. +Any argument which looks like a signal name (that is, +C) indicates that B should install a +handler for that name. =item I