M.J.T. Guy [Sat, 8 Mar 1997 20:12:17 +0000 (20:12 +0000)]
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
@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);
}
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;