From: M.J.T. Guy Date: Sat, 8 Mar 1997 20:12:17 +0000 (+0000) Subject: Carp with multiple arguments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d43563dda8f974d66e255d10af6e34c09bb46cb4;p=p5sagit%2Fp5-mst-13.2.git Carp with multiple arguments Subject: Carp with multiple arguments (and lack of tests) carp/croak/confess are documented as similar to warn/die, but whereas warn/die print multiple arguments, carp/croak/confess print only the first. Assuming that this is a bug rather than a feature, the following patch corrects it. (And if it _is_ a feature, the pod needs updating instead, to explain it away.) Trying to be polite, I thought I'd update the Carp tests to cover this case. But I couldn't find any Carp tests ... I'll have a go at rectifying this lacuna. But not till tomorrow. p5p-msgid: E0w3STZ-0007RW-00@taurus.cus.cam.ac.uk --- diff --git a/lib/Carp.pm b/lib/Carp.pm index de58648..ec08d30 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -37,7 +37,7 @@ require Exporter; @EXPORT = qw(confess croak carp); sub longmess { - my $error = shift; + my $error = join '', @_; my $mess = ""; my $i = 1 + $CarpLevel; my ($pack,$file,$line,$sub,$hargs,$eval,$require); @@ -85,7 +85,7 @@ sub longmess { } sub shortmess { # Short-circuit &longmess if called via multiple packages - my $error = $_[0]; # Instead of "shift" + my $error = join '', @_; my ($prevpack) = caller(1); my $extra = $CarpLevel; my $i = 2;