This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix Module::CoreList versions
[perl5.git] / lib / sigtrap.pm
index c081123..7d80146 100644 (file)
@@ -8,7 +8,7 @@ sigtrap - Perl pragma to enable simple signal handling
 
 use Carp;
 
-$VERSION = 1.02;
+$VERSION = 1.08;
 $Verbose ||= 0;
 
 sub import {
@@ -95,13 +95,12 @@ 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;
-           s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
-           s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
+            require 'meta_notation.pm';
+            $_ = _meta_notation($_) if /[[:^print:]]/a;
            push(@a, $_);
        }
        $w = $w ? '@ = ' : '$ = ';
@@ -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));
     }
@@ -180,7 +179,8 @@ 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