Honor trailing \n in messages, as is done for warn().
authorPerl 5 Porters <perl5-porters.nicoh.com>
Mon, 1 Jan 1996 23:10:38 +0000 (23:10 +0000)
committerAndy Dougherty <doughera.lafayette.edu>
Mon, 1 Jan 1996 23:10:38 +0000 (23:10 +0000)
lib/Carp.pm

index ba21d9c..2d857ba 100644 (file)
@@ -39,8 +39,12 @@ sub longmess {
     my $i = 1 + $CarpLevel;
     my ($pack,$file,$line,$sub);
     while (($pack,$file,$line,$sub) = caller($i++)) {
-       $mess .= "\t$sub " if $error eq "called";
-       $mess .= "$error at $file line $line\n";
+       if ($error =~ m/\n$/) {
+           $mess .= $error;
+       } else {
+           $mess .= "\t$sub " if $error eq "called";
+           $mess .= "$error at $file line $line\n";
+       }
        $error = "called";
     }
     $mess || $error;