diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-18 05:11:02 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-18 05:11:02 +0000 |
commit | b14a08e7106771f0db98a4382a98112539abbbef (patch) | |
tree | 84263b579afe32eb948c63daa9bc428e100d1b19 /lib/Carp.pm | |
parent | a4aef66ba71abc4d5aae84861d6811c5941b6946 (diff) | |
download | perl-b14a08e7106771f0db98a4382a98112539abbbef.tar.gz |
display thread id in diagnostics (suggested by Dan Sugalski)
p4raw-id: //depot/perl@3696
Diffstat (limited to 'lib/Carp.pm')
-rw-r--r-- | lib/Carp.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Carp.pm b/lib/Carp.pm index 5fb8809900..8301f37da7 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -175,7 +175,10 @@ sub longmess { } # here's where the error message, $mess, gets constructed $mess .= "\t$sub " if $error eq "called"; - $mess .= "$error at $file line $line\n"; + $mess .= "$error at $file line $line"; + $mess .= " thread " . Thread->self->tid + if exists $main::{'Thread::'}; + $mess .= "\n"; } # we don't need to print the actual error message again so we can # change this to "called" so that the string "$error at $file line @@ -254,7 +257,12 @@ sub shortmess { # Short-circuit &longmess if called via multiple packages # relevant error message and return it. die() doesn't like # to be given NUL characters (which $msg may contain) so we # remove them first. - (my $msg = "$error at $file line $line\n") =~ tr/\0//d; + my $msg; + $msg = "$error at $file line $line"; + $msg .= " thread " . Thread->self->tid + if exists $main::{'Thread::'}; + $msg .= "\n"; + $msg =~ tr/\0//d; return $msg; } } |