summaryrefslogtreecommitdiff
path: root/lib/overload.pm
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-09 20:35:35 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-09 20:35:35 -0800
commite6bb0a40852b954f3cc56d4b9bbfccef906b70a5 (patch)
tree7c77796b6c2dd386a3b0b52835af6d8fea41e6c7 /lib/overload.pm
parent8b9a1153f14d44cea2fcef118be9de0eea3dcaca (diff)
downloadperl-e6bb0a40852b954f3cc56d4b9bbfccef906b70a5.tar.gz
[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.
Diffstat (limited to 'lib/overload.pm')
-rw-r--r--lib/overload.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/overload.pm b/lib/overload.pm
index 4e01e45d09..1f9f461da1 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -50,7 +50,7 @@ sub unimport {
sub Overloaded {
my $package = shift;
$package = ref $package if ref $package;
- $package->can('()');
+ mycan ($package, '()');
}
sub ov_method {