summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2012-02-02 16:07:10 +0000
committerZefram <zefram@fysh.org>2012-02-02 16:07:10 +0000
commit879b0cab8575cdc155c45c42eb82075648761936 (patch)
tree81bb2870c1a54c3d91fc83ad2107a89ec6d8f4dd
parent62e90759156bee3f2bcbf1ac6fd055aeab81b9e4 (diff)
downloadperl-879b0cab8575cdc155c45c42eb82075648761936.tar.gz
make Carp messages match die properly
Add dot to end of message from Carp, to match the formatting from CORE::die. The stack trace, coming after the message, is unchanged.
-rw-r--r--cpan/autodie/t/backcompat.t2
-rw-r--r--dist/Carp/lib/Carp.pm6
-rw-r--r--dist/Carp/t/Carp.t26
-rw-r--r--ext/Hash-Util/t/Util.t2
-rw-r--r--t/lib/warnings/2use2
-rw-r--r--t/lib/warnings/9enabled64
6 files changed, 51 insertions, 51 deletions
diff --git a/cpan/autodie/t/backcompat.t b/cpan/autodie/t/backcompat.t
index acb81245b8..174d6da9b0 100644
--- a/cpan/autodie/t/backcompat.t
+++ b/cpan/autodie/t/backcompat.t
@@ -8,7 +8,7 @@ eval {
open(my $fh, '<', NO_SUCH_FILE);
};
-my $old_msg = qr{Can't open\(GLOB\(0x[0-9a-f]+\), <, xyzzy_this_file_is_not_here\): .* at \(eval \d+\)(?:\[.*?\])? line \d+\s+main::__ANON__\('GLOB\(0x[0-9a-f]+\)',\s*'<',\s*'xyzzy_this_file_is_not_here'\) called at \S+ line \d+\s+eval \Q{...}\E called at \S+ line \d+};
+my $old_msg = qr{Can't open\(GLOB\(0x[0-9a-f]+\), <, xyzzy_this_file_is_not_here\): .* at \(eval \d+\)(?:\[.*?\])? line \d+\.\s+main::__ANON__\('GLOB\(0x[0-9a-f]+\)',\s*'<',\s*'xyzzy_this_file_is_not_here'\) called at \S+ line \d+\s+eval \Q{...}\E called at \S+ line \d+};
like($@,$old_msg,"Backwards compat ugly messages");
is(ref($@),"", "Exception is a string, not an object");
diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index c08af19b0f..b4dce03e2b 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -24,7 +24,7 @@ BEGIN {
}
}
-our $VERSION = '1.24';
+our $VERSION = '1.25';
our $MaxEvalLen = 0;
our $Verbose = 0;
@@ -297,7 +297,7 @@ sub ret_backtrace {
$mess .= $1;
}
}
- $mess .= "\n";
+ $mess .= "\.\n";
while ( my %i = caller_info( ++$i ) ) {
$mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
@@ -318,7 +318,7 @@ sub ret_summary {
}
my %i = caller_info($i);
- return "$err at $i{file} line $i{line}$tid_msg\n";
+ return "$err at $i{file} line $i{line}$tid_msg\.\n";
}
sub short_error_loc {
diff --git a/dist/Carp/t/Carp.t b/dist/Carp/t/Carp.t
index d20ca22eba..803ec0af2d 100644
--- a/dist/Carp/t/Carp.t
+++ b/dist/Carp/t/Carp.t
@@ -29,7 +29,7 @@ BEGIN {
{
local $SIG{__WARN__} = sub {
- like $_[0], qr/ok (\d+)\n at.+\b(?i:carp\.t) line \d+$/, 'ok 2\n';
+ like $_[0], qr/ok (\d+)\n at.+\b(?i:carp\.t) line \d+\.$/, 'ok 2\n';
};
carp "ok 2\n";
@@ -37,7 +37,7 @@ BEGIN {
{
local $SIG{__WARN__} = sub {
- like $_[0], qr/(\d+) at.+\b(?i:carp\.t) line \d+$/, 'carp 3';
+ like $_[0], qr/(\d+) at.+\b(?i:carp\.t) line \d+\.$/, 'carp 3';
};
carp 3;
@@ -46,7 +46,7 @@ BEGIN {
sub sub_4 {
local $SIG{__WARN__} = sub {
like $_[0],
- qr/^(\d+) at.+\b(?i:carp\.t) line \d+\n\tmain::sub_4\(\) called at.+\b(?i:carp\.t) line \d+$/,
+ qr/^(\d+) at.+\b(?i:carp\.t) line \d+\.\n\tmain::sub_4\(\) called at.+\b(?i:carp\.t) line \d+$/,
'cluck 4';
};
@@ -58,7 +58,7 @@ sub_4;
{
local $SIG{__DIE__} = sub {
like $_[0],
- qr/^(\d+) at.+\b(?i:carp\.t) line \d+\n\teval \Q{...}\E called at.+\b(?i:carp\.t) line \d+$/,
+ qr/^(\d+) at.+\b(?i:carp\.t) line \d+\.\n\teval \Q{...}\E called at.+\b(?i:carp\.t) line \d+$/,
'croak 5';
};
@@ -68,7 +68,7 @@ sub_4;
sub sub_6 {
local $SIG{__DIE__} = sub {
like $_[0],
- qr/^(\d+) at.+\b(?i:carp\.t) line \d+\n\teval \Q{...}\E called at.+\b(?i:carp\.t) line \d+\n\tmain::sub_6\(\) called at.+\b(?i:carp\.t) line \d+$/,
+ qr/^(\d+) at.+\b(?i:carp\.t) line \d+\.\n\teval \Q{...}\E called at.+\b(?i:carp\.t) line \d+\n\tmain::sub_6\(\) called at.+\b(?i:carp\.t) line \d+$/,
'confess 6';
};
@@ -193,8 +193,8 @@ sub w { cluck @_ }
# $Carp::Verbose;
{
my $aref = [
- qr/t at \S*(?i:carp.t) line \d+/,
- qr/t at \S*(?i:carp.t) line \d+\n\s*main::x\('t'\) called at \S*(?i:carp.t) line \d+/
+ qr/t at \S*(?i:carp.t) line \d+\./,
+ qr/t at \S*(?i:carp.t) line \d+\.\n\s*main::x\('t'\) called at \S*(?i:carp.t) line \d+/
];
my $i = 0;
@@ -247,8 +247,8 @@ sub w { cluck @_ }
{
my $i = 0;
my $aref = [
- qr/1234 at \S*(?i:carp.t) line \d+\n\s*main::w\(1, 2, 3, 4\) called at \S*(?i:carp.t) line \d+/,
- qr/1234 at \S*(?i:carp.t) line \d+\n\s*main::w\(1, 2, \.\.\.\) called at \S*(?i:carp.t) line \d+/,
+ qr/1234 at \S*(?i:carp.t) line \d+\.\n\s*main::w\(1, 2, 3, 4\) called at \S*(?i:carp.t) line \d+/,
+ qr/1234 at \S*(?i:carp.t) line \d+\.\n\s*main::w\(1, 2, \.\.\.\) called at \S*(?i:carp.t) line \d+/,
];
for (@$aref) {
@@ -266,8 +266,8 @@ sub w { cluck @_ }
{
my $i = 0;
my $aref = [
- qr/1 at \S*(?i:carp.t) line \d+\n\s*main::w\(1\) called at \S*(?i:carp.t) line \d+/,
- qr/1 at \S*(?i:carp.t) line \d+$/,
+ qr/1 at \S*(?i:carp.t) line \d+\.\n\s*main::w\(1\) called at \S*(?i:carp.t) line \d+/,
+ qr/1 at \S*(?i:carp.t) line \d+\.$/,
];
for (@$aref) {
@@ -305,7 +305,7 @@ sub cluck_undef {
local $SIG{__WARN__} = sub {
like $_[0],
- qr/^Bang! at.+\b(?i:carp\.t) line \d+\n\tmain::cluck_undef\(0, 'undef', 2, undef, 4\) called at.+\b(?i:carp\.t) line \d+$/,
+ qr/^Bang! at.+\b(?i:carp\.t) line \d+\.\n\tmain::cluck_undef\(0, 'undef', 2, undef, 4\) called at.+\b(?i:carp\.t) line \d+$/,
"cluck doesn't quote undef";
};
@@ -427,7 +427,7 @@ SKIP:
<D::DATA> for 1..2;
eval { croak 'heek' };
$@ =~ s/\n.*//; # just check first line
-is $@, "heek at ".__FILE__." line ".(__LINE__-2).", <DATA> line 2\n",
+is $@, "heek at ".__FILE__." line ".(__LINE__-2).", <DATA> line 2.\n",
'last handle line num is mentioned';
diff --git a/ext/Hash-Util/t/Util.t b/ext/Hash-Util/t/Util.t
index a7cd946786..74d823db05 100644
--- a/ext/Hash-Util/t/Util.t
+++ b/ext/Hash-Util/t/Util.t
@@ -155,7 +155,7 @@ is( $hash{locked}, 42, 'unlock_value' );
my %hash = (foo => 42, bar => undef);
eval { lock_keys(%hash, qw(foo baz)); };
is( $@, sprintf("Hash has key 'bar' which is not in the new key ".
- "set at %s line %d\n", __FILE__, __LINE__ - 2),
+ "set at %s line %d.\n", __FILE__, __LINE__ - 2),
'carp test' );
}
diff --git a/t/lib/warnings/2use b/t/lib/warnings/2use
index eef0f3ffec..e5a8103b81 100644
--- a/t/lib/warnings/2use
+++ b/t/lib/warnings/2use
@@ -8,7 +8,7 @@ __END__
# check illegal category is caught
use warnings 'this-should-never-be-a-warning-category' ;
EXPECT
-Unknown warnings category 'this-should-never-be-a-warning-category' at - line 3
+Unknown warnings category 'this-should-never-be-a-warning-category' at - line 3.
BEGIN failed--compilation aborted at - line 3.
########
diff --git a/t/lib/warnings/9enabled b/t/lib/warnings/9enabled
index 68b0a27da3..60b7c48da3 100644
--- a/t/lib/warnings/9enabled
+++ b/t/lib/warnings/9enabled
@@ -344,8 +344,8 @@ eval {
} ;
print $@ ;
EXPECT
-Usage: warnings::warn([category,] 'message') at - line 5
-Unknown warnings category 'fred' at - line 9
+Usage: warnings::warn([category,] 'message') at - line 5.
+Unknown warnings category 'fred' at - line 9.
########
# check warnings::warnif
@@ -359,8 +359,8 @@ eval {
} ;
print $@ ;
EXPECT
-Usage: warnings::warnif([category,] 'message') at - line 5
-Unknown warnings category 'fred' at - line 9
+Usage: warnings::warnif([category,] 'message') at - line 5.
+Unknown warnings category 'fred' at - line 9.
########
--FILE-- abc18.pm
@@ -373,7 +373,7 @@ use warnings "io" ;
use abc18;
abc18::check() ;
EXPECT
-hello at - line 3
+hello at - line 3.
########
--FILE-- abc19.pm
@@ -386,7 +386,7 @@ use warnings "io" ;
use abc19;
abc19::check() ;
EXPECT
-hello at - line 3
+hello at - line 3.
########
--FILE-- abc20.pm
@@ -402,7 +402,7 @@ eval {
} ;
print "[[$@]]\n";
EXPECT
-hello at - line 4
+hello at - line 4.
[[]]
########
@@ -419,7 +419,7 @@ eval {
} ;
print "[[$@]]\n";
EXPECT
-[[hello at - line 4
+[[hello at - line 4.
]]
########
-W
@@ -463,7 +463,7 @@ use warnings 'syntax' ;
use abc24 ;
abc24::check() ;
EXPECT
-package 'abc24' not registered for warnings at abc24.pm line 4
+package 'abc24' not registered for warnings at abc24.pm line 4.
########
--FILE-- abc25.pm
@@ -478,7 +478,7 @@ use warnings 'syntax' ;
use abc25 ;
abc25::check() ;
EXPECT
-package 'abc25' not registered for warnings at abc25.pm line 4
+package 'abc25' not registered for warnings at abc25.pm line 4.
########
--FILE-- abc26.pm
@@ -493,7 +493,7 @@ use warnings 'syntax' ;
use abc26 ;
abc26::check() ;
EXPECT
-package 'abc26' not registered for warnings at abc26.pm line 4
+package 'abc26' not registered for warnings at abc26.pm line 4.
########
--FILE-- abc27.pm
@@ -652,7 +652,7 @@ use abc34;
use warnings "abc34" ;
abc34::check() ;
EXPECT
-hello at - line 3
+hello at - line 3.
########
--FILE-- abc35.pm
@@ -664,7 +664,7 @@ sub check { warnings::warn("hello") }
use abc35;
abc35::check() ;
EXPECT
-hello at - line 2
+hello at - line 2.
########
--FILE-- abc36.pm
@@ -680,7 +680,7 @@ eval {
} ;
print "[[$@]]\n";
EXPECT
-hello at - line 4
+hello at - line 4.
[[]]
########
@@ -697,7 +697,7 @@ eval {
} ;
print "[[$@]]\n";
EXPECT
-[[hello at - line 4
+[[hello at - line 4.
]]
########
-W
@@ -1005,9 +1005,9 @@ ok1
ok2
ok3
ok4
-my message 1 at - line 3
-my message 2 at - line 3
-my message 3 at - line 3
+my message 1 at - line 3.
+my message 2 at - line 3.
+my message 3 at - line 3.
########
--FILE-- def.pm
@@ -1044,9 +1044,9 @@ ok1
ok2
ok3
ok4
-my message 1 at abc49.pm line 5
-my message 2 at abc49.pm line 5
-my message 3 at abc49.pm line 5
+my message 1 at abc49.pm line 5.
+my message 2 at abc49.pm line 5.
+my message 3 at abc49.pm line 5.
########
--FILE-- def.pm
@@ -1089,8 +1089,8 @@ ok2
ok3
ok4
ok5
-my message 1 at - line 4
-my message 3 at - line 4
+my message 1 at - line 4.
+my message 3 at - line 4.
########
--FILE-- def.pm
@@ -1166,19 +1166,19 @@ ok3
ok4
ok5
ok6
-my message 1 at - line 5
-my message 2 at - line 5
-my message 4 at - line 5
-my message 8 at - line 5
+my message 1 at - line 5.
+my message 2 at - line 5.
+my message 4 at - line 5.
+my message 8 at - line 5.
**
ok1
ok2
ok3
ok4
ok5
-my message 1 at - line 8
-my message 2 at - line 8
-my message 4 at - line 8
+my message 1 at - line 8.
+my message 2 at - line 8.
+my message 4 at - line 8.
########
--FILE-- abc52.pm
@@ -1195,8 +1195,8 @@ use abc52;
use warnings("abc52", "abc52::bar");
abc52::check() ;
EXPECT
-hello at - line 3
-hello bar at - line 3
+hello at - line 3.
+hello bar at - line 3.
########
--FILE--