diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Carp.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Carp.pm b/lib/Carp.pm index 8301f37da7..364442436b 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -176,8 +176,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"; - $mess .= " thread " . Thread->self->tid - if exists $main::{'Thread::'}; + if (exists $main::{'Thread::'}) { + my $tid = Thread->self->tid; + $mess .= " thread $tid" if $tid; + } $mess .= "\n"; } # we don't need to print the actual error message again so we can @@ -259,8 +261,10 @@ sub shortmess { # Short-circuit &longmess if called via multiple packages # remove them first. my $msg; $msg = "$error at $file line $line"; - $msg .= " thread " . Thread->self->tid - if exists $main::{'Thread::'}; + if (exists $main::{'Thread::'}) { + my $tid = Thread->self->tid; + $mess .= " thread $tid" if $tid; + } $msg .= "\n"; $msg =~ tr/\0//d; return $msg; |