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.
package overload;
-our $VERSION = '1.10';
+our $VERSION = '1.11';
sub nil {}
my $globref = shift;
return undef unless $globref;
my $sub = \&{*$globref};
- return $sub if $sub ne \&nil;
+ require Scalar::Util;
+ return $sub
+ if Scalar::Util::refaddr($sub) != Scalar::Util::refaddr(\&nil);
return shift->can($ {*$globref});
}
$| = 1;
BEGIN { require './test.pl' }
-plan tests => 4881;
+plan tests => 4882;
use Scalar::Util qw(tainted);
'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
=item *
+C<overload> has been upgraded from version 1.10 to 1.11.
+
+C<overload::Method> can now handle subroutines that are themselves blessed
+into overloaded classes
+L<[perl #71998]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=71998>.
+
+=item *
+
C<PathTools> has been upgraded from version 3.31_01 to 3.33.
=item *