This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More updates to Module-CoreList for Perl 5.20.2
[perl5.git] / lib / sigtrap.pm
index ed5925b..df728c8 100644 (file)
@@ -8,7 +8,7 @@ sigtrap - Perl pragma to enable simple signal handling
 
 use Carp;
 
-$VERSION = 1.02;
+$VERSION = 1.07;
 $Verbose ||= 0;
 
 sub import {
@@ -95,8 +95,7 @@ sub handler_traceback {
     # Now go for broke.
     for ($i = 1; ($p,$f,$l,$s,$h,$w,$e,$r) = caller($i); $i++) {
         @a = ();
-       for $arg (@args) {
-           $_ = "$arg";
+       for (@{[@args]}) {
            s/([\'\\])/\\$1/g;
            s/([^\0]*)/'$1'/
              unless /^(?: -?[\d.]+ | \*[\w:]* )$/x;
@@ -115,7 +114,7 @@ sub handler_traceback {
        } elsif ($s eq '(eval)') {
            $s = "eval {...}";
        }
-       $f = "file `$f'" unless $f eq '-e';
+       $f = "file '$f'" unless $f eq '-e';
        $mess = "$w$s$a called from $f line $l\n";
        syswrite(STDERR, $mess, length($mess));
     }
@@ -167,9 +166,9 @@ installed signals.
 
 =item B<stack-trace>
 
-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<die>
 
@@ -180,13 +179,14 @@ The handler used for subsequently installed signals calls C<die>
 
 I<your-handler> will be used as the handler for subsequently installed
 signals.  I<your-handler> can be any value which is valid as an
-assignment to an element of C<%SIG>.
+assignment to an element of C<%SIG>. See L<perlvar> for examples of
+handler functions.
 
 =back
 
 =head2 SIGNAL LISTS
 
-B<sigtrap> has two built-in lists of signals to trap.  They are:
+B<sigtrap> has a few built-in lists of signals to trap.  They are:
 
 =over 4
 
@@ -222,7 +222,7 @@ silently ignored.
 
 =item B<untrapped>
 
-This token tells B<sigtrap> only to install handlers for subsequently
+This token tells B<sigtrap> to install handlers only for subsequently
 listed signals which aren't already trapped or ignored.
 
 =item B<any>
@@ -232,9 +232,9 @@ listed signals.  This is the default behavior.
 
 =item I<signal>
 
-Any argument which looks like a signals name (that is,
-C</^[A-Z][A-Z0-9]*$/>) is taken as a signal name and indicates that
-B<sigtrap> should install a handler for it.
+Any argument which looks like a signal name (that is,
+C</^[A-Z][A-Z0-9]*$/>) indicates that B<sigtrap> should install a
+handler for that name.
 
 =item I<number>