[perl #40333] Stop overload::Overloaded from calling ->can
authorFather Chrysostomos <sprout@cpan.org>
Tue, 10 Jan 2012 04:35:35 +0000 (20:35 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 10 Jan 2012 04:35:35 +0000 (20:35 -0800)
commite6bb0a40852b954f3cc56d4b9bbfccef906b70a5
tree7c77796b6c2dd386a3b0b52835af6d8fea41e6c7
parent8b9a1153f14d44cea2fcef118be9de0eea3dcaca
[perl #40333] Stop overload::Overloaded from calling ->can

It’s possible, and too easy, for classes to define a can method to
deal with AUTOLOAD, without taking overloading into account.  Since
AUTOLOAD is the main reason for overriding can, and since overloading
does not respect autoloading, can overrides should not be expected to
deal with it.

Since overload.pm already has a mycan function that fits this purpose,
this commit changes Overloaded to use that.

The test includes an example of a class structure that the previous
Overloaded implementation could not handle.
lib/overload.pm
lib/overload.t