diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-30 18:27:58 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-30 20:16:31 -0700 |
commit | f0e9f182fe3d00c8f9a8a6697fbd198f07fcc242 (patch) | |
tree | e1f225f58885de9a2eccdcb3d080fc12b46a3911 /lib/overload.t | |
parent | 2e3468793982c433c4b3838a57fb434ecca63875 (diff) | |
download | perl-f0e9f182fe3d00c8f9a8a6697fbd198f07fcc242.tar.gz |
Restore the package name to overload errors; fix crash
Commit bfcb351493b (which was backported to 5.8.8) caused these error
messages always to mention the overload package, instead of the pack-
age involved:
Can't resolve method "foo" overloading "+" in package "baz"
Stub found while resolving method "foo" overloading "+" in package "baz"
This commit fixes that. A compiler warning alerted me to the possi-
bility of HvNAME being null, so I wrote a small test for that, found
that it crashed, and incorporated the fix for the crash into the same
commit (since it’s the same line of code).
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/overload.t b/lib/overload.t index 605429ede9..2efc5aa47d 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 4982; +plan tests => 4983; use Scalar::Util qw(tainted); @@ -2173,7 +2173,7 @@ fresh_perl_is use overload '+' => 'justice'; eval {bless[]}; ::like $@, qr/^Can't resolve method "justice" overloading "\+" in p(?x: - )ackage "overload" at /, + )ackage "Justus" at /, 'Error message when explicitly named overload method does not exist'; package JustUs; @@ -2182,8 +2182,16 @@ fresh_perl_is "JustUs"->${\"(+"}; eval {bless []}; ::like $@, qr/^Stub found while resolving method "\?{3}" overloadin(?x: - )g "\+" in package "overload" at /, + )g "\+" in package "JustUs" at /, 'Error message when sub stub is encountered'; } +{ # undefining the overload stash -- KEEP THIS TEST LAST + package ant; + use overload '+' => 'onion'; + $_ = \&overload::nil; + undef %overload::; + ::ok(1, 'no crash when undefining %overload::'); +} + # EOF |