summaryrefslogtreecommitdiff
path: root/dist/Carp/lib/Carp.pm
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2016-03-06 20:37:25 +0200
committerTony Cook <tony@develop-help.com>2016-03-07 15:36:55 +1100
commit6ca94a7e349c01c8c0b73c24e6a957c3bd617ae6 (patch)
tree80e74ecccdeb1584b8a9ac6d734486e28301dc6f /dist/Carp/lib/Carp.pm
parent2dc40b2d7c20b0d31c4343ac23cda9799f234a65 (diff)
downloadperl-6ca94a7e349c01c8c0b73c24e6a957c3bd617ae6.tar.gz
Fix RTCPAN#107225 : longmess returns 1 on ref.
See: https://rt.cpan.org/Public/Bug/Display.html?id=107225 . Also discovered as a bug in perl -d by me (= Shlomi Fish) and reported after the original report. longmess() returns "1" when called in scalar context if passed a reference.
Diffstat (limited to 'dist/Carp/lib/Carp.pm')
-rw-r--r--dist/Carp/lib/Carp.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index 9421c74211..f39302d4c0 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -87,7 +87,7 @@ BEGIN {
}
}
-our $VERSION = '1.38';
+our $VERSION = '1.39';
$VERSION =~ tr/_//d;
our $MaxEvalLen = 0;
@@ -445,7 +445,9 @@ sub long_error_loc {
}
sub longmess_heavy {
- return @_ if ref( $_[0] ); # don't break references as exceptions
+ if ( ref( $_[0] ) ) { # don't break references as exceptions
+ return wantarray ? @_ : $_[0];
+ }
my $i = long_error_loc();
return ret_backtrace( $i, @_ );
}