X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/58618f23d81135f8218a27f5197a29e9c271d2cb..7a501b103df120b25890082e5574839acb479fea:/lib/diagnostics.pm diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index b51376f..e81581b 100755 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -28,7 +28,8 @@ Using diagnostics to get stack traces from a misbehaving script: =head2 The C Pragma This module extends the terse diagnostics normally emitted by both the -perl compiler and the perl interpreter, augmenting them with the more +perl compiler and the perl interpreter (from running perl with a -w +switch or C), augmenting them with the more explicative and endearing descriptions found in L. Like the other pragmata, it affects the compilation phase of your program rather than merely the execution phase. @@ -59,7 +60,7 @@ allowing duplicate user messages to be displayed. This module also adds a stack trace to the error message when perl dies. This is useful for pinpointing what caused the death. The B<-traceonly> (or -just B<-t>) flag turns off the explantions of warning messages leaving just +just B<-t>) flag turns off the explanations of warning messages leaving just the stack traces. So if your script is dieing, run it again with perl -Mdiagnostics=-traceonly my_bad_script @@ -184,7 +185,7 @@ use 5.006; use Carp; $Carp::Internal{__PACKAGE__.""}++; -our $VERSION = 1.14; +our $VERSION = 1.16; our $DEBUG; our $VERBOSE; our $PRETTY; @@ -465,12 +466,12 @@ sub import { $PRETTY++; next; }; - - /^-t(race)?$/ && do { + # matches trace and traceonly for legacy doc mixup reasons + /^-t(race(only)?)?$/ && do { $TRACEONLY++; next; }; - /^-w(arntrace)?$/ && do { + /^-w(arntrace)?$/ && do { $WARNTRACE++; next; }; @@ -561,6 +562,7 @@ sub splainthis { # but be aware of messsages containing " at this-or-that" my $real = 0; my @secs = split( / at / ); + return unless @secs; $_ = $secs[0]; for my $i ( 1..$#secs ){ if( $secs[$i] =~ /.+? (?:line|chunk) \d+/ ){