From: Steve Hay Date: Tue, 25 May 2004 16:05:02 +0000 (+0100) Subject: Fix anomalies in Carp functions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=59b0a8b7fe6b66a1488f6943ad58e73704f876b0;p=p5sagit%2Fp5-mst-13.2.git Fix anomalies in Carp functions Message-ID: <40B3609E.5060502@uk.radan.com> p4raw-id: //depot/perl@22876 --- diff --git a/lib/Carp.t b/lib/Carp.t index 2ea98d8..cc2da17 100644 --- a/lib/Carp.t +++ b/lib/Carp.t @@ -11,7 +11,7 @@ print "ok 1\n"; $SIG{__WARN__} = sub { print "ok $1\n" - if $_[0] =~ m!ok (\d+)$! }; + if $_[0] =~ m!ok (\d+)\n at .+\b(?i:carp\.t) line \d+$! }; carp "ok 2\n"; diff --git a/lib/Carp/Heavy.pm b/lib/Carp/Heavy.pm index 49e10f2..fe7fec4 100644 --- a/lib/Carp/Heavy.pm +++ b/lib/Carp/Heavy.pm @@ -138,13 +138,8 @@ sub ret_backtrace { $tid_msg = " thread $tid" if $tid; } - { if ($err =~ /\n$/) { # extra block to localise $1 etc - $mess = $err; - } - else { - my %i = caller_info($i); - $mess = "$err at $i{file} line $i{line}$tid_msg\n"; - }} + my %i = caller_info($i); + $mess = "$err at $i{file} line $i{line}$tid_msg\n"; while (my %i = caller_info(++$i)) { $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n"; @@ -155,7 +150,6 @@ sub ret_backtrace { sub ret_summary { my ($i, @error) = @_; - my $mess; my $err = join '', @error; $i++; diff --git a/lib/autouse.t b/lib/autouse.t index bdd2fba..bc8e401 100644 --- a/lib/autouse.t +++ b/lib/autouse.t @@ -39,7 +39,7 @@ use autouse 'Carp' => qw(carp croak); local $SIG{__WARN__} = sub { push @warning, @_ }; carp "this carp was predeclared and autoused\n"; ok( scalar @warning, 1 ); - ok( $warning[0], "this carp was predeclared and autoused\n" ); + ok( $warning[0], qr/^this carp was predeclared and autoused\n/ ); eval { croak "It is but a scratch!" }; ok( $@, qr/^It is but a scratch!/);