diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-09-28 13:53:51 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-09-28 13:53:51 -0700 |
commit | 56f08af290811ab8a077e73d46dff25b99848a89 (patch) | |
tree | 076fcdff1f899170901b7f577f784fa31a546a2b /lib/overload.t | |
parent | 9dcc53ea14d7a502bb5ac0877765bde14f8cc721 (diff) | |
download | perl-56f08af290811ab8a077e73d46dff25b99848a89.tar.gz |
[perl #71998] overload::Method can die with blessed methods
If an overload method is itself blessed into a class that has
overloaded operators but does not have fallback enabled, then an error
is produced:
$ perl5.10.0
use overload '+' => sub{};
bless overload::Method main => '+';
overload::Method main => '+';
^D
Operation "ne": no method found,
left argument in overloaded package main,
right argument has no overloaded magic at /usr/local/lib/perl5/5.10.0/
overload.pm line 59.
The attached patch fixes this.
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index 417c1cb043..ef65ea534d 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 4881; +plan tests => 4882; use Scalar::Util qw(tainted); @@ -1999,4 +1999,12 @@ fresh_perl_is 'use overload from the main package' ; +{ + package blessed_methods; + use overload '+' => sub {}; + bless overload::Method __PACKAGE__,'+'; + eval { overload::Method __PACKAGE__,'+' }; + ::is($@, '', 'overload::Method and blessed overload methods'); +} + # EOF |