Change 12496 by gsar@moonru on 2001/10/18 15:38:22

        Carp::shortmess_heavy() doesn't notice trailing newline in
        message and suppress line number info (from Steve Hay
        <[EMAIL PROTECTED]>)

Affected files ...

... //depot/maint-5.6/perl/lib/Carp/Heavy.pm#6 edit

Differences ...

==== //depot/maint-5.6/perl/lib/Carp/Heavy.pm#6 (text) ====
Index: perl/lib/Carp/Heavy.pm
--- perl/lib/Carp/Heavy.pm.~1~  Thu Oct 18 09:45:06 2001
+++ perl/lib/Carp/Heavy.pm      Thu Oct 18 09:45:06 2001
@@ -53,7 +53,7 @@
        #  subsequent times: $mess .= $sub $error at $file line $line
        #                                  ^^^^^^
        #                                 "called"
-       if ($error =~ m/\n$/) {
+       if ($error =~ m/\n\z/) {
            $mess .= $error;
        } else {
            # Build a string, $sub, which names the sub-routine called.
@@ -226,12 +226,18 @@
            # OK!  We've got a candidate package.  Time to construct the
            # relevant error message and return it.
            my $msg;
-           $msg = "$error at $file line $line";
-           if (defined &Thread::tid) {
-               my $tid = Thread->self->tid;
-               $msg .= " thread $tid" if $tid;
+           # make sure we don't add debug info if it ends with a newline
+           if ($error =~ /\n\z/) {
+               $msg = $error;
+           }
+           else {
+               $msg = "$error at $file line $line";
+               if (defined &Thread::tid) {
+                   my $tid = Thread->self->tid;
+                   $msg .= " thread $tid" if $tid;
+               }
+               $msg .= "\n";
            }
-           $msg .= "\n";
            return $msg;
        }
     }
End of Patch.

Reply via email to