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 | 9efbc0eb9ef0a7b1489f59143775f10b17cd372d (patch) | |
tree | 84263b579afe32eb948c63daa9bc428e100d1b19 /lib | |
parent | dcdda58dd900ef44288e03991974d9c7ddb74710 (diff) | |
download | perl-9efbc0eb9ef0a7b1489f59143775f10b17cd372d.tar.gz |
display thread id in diagnostics (suggested by Dan Sugalski)
p4raw-id: //depot/perl@3696
Diffstat (limited to 'lib')
-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; } } |