correction for passing partial on initial AUTOLOAD

This commit is contained in:
Eric A. Miller
2012-11-28 19:38:04 -05:00
parent a83bc1bcb2
commit 3af05ebba5

12
Info.pm
View File

@@ -4114,14 +4114,16 @@ Returns undef if the method does not exist and can not be created.
sub can { sub can {
my $self = shift; my $self = shift;
my $method = shift; my $method = shift;
my $super = shift;
# use results of parent can() # use results of parent can()
my $meth_ref = $self->SUPER::can($method); my $meth_ref = $self->SUPER::can($method);
# Don't return if passed $super as it means we were called # Don't return if passed $super as it means we were called
# from AUTOLOAD for a method that hasn't been generated yet. # from AUTOLOAD for a method that hasn't been generated yet.
return $meth_ref if ( !$super && $meth_ref ); if ($meth_ref) {
return $meth_ref
unless ( defined $AUTOLOAD && $AUTOLOAD =~ /SUPER::$method$/ );
}
my $oid = $self->_validate_autoload_method($method); my $oid = $self->_validate_autoload_method($method);
return unless $oid; return unless $oid;
@@ -4186,7 +4188,7 @@ subclass.
sub AUTOLOAD { sub AUTOLOAD {
my $self = shift; my $self = shift;
my ($super, $sub_name) = $AUTOLOAD =~ /(SUPER)?::(\w+)$/; my ($sub_name) = $AUTOLOAD =~ /::(\w+)$/;
return if $sub_name =~ /DESTROY$/; return if $sub_name =~ /DESTROY$/;
@@ -4203,8 +4205,8 @@ sub AUTOLOAD {
); );
} }
return unless my $meth_ref = $self->can($sub_name, $super, @_); return unless my $meth_ref = $self->can($sub_name, @_);
return $self->$meth_ref; return $self->$meth_ref(@_);
} }
1; 1;