This works just fine for me, and does all the appropriate AUTOLOAD business.if ($method eq 'child_method') { print "Child->child_method\n"; } else { $method = "SUPER::$method"; $self->$method(@_); }
package Child; @ISA = qw(Parent); sub AUTOLOAD { my $self = shift; (my $method = $AUTOLOAD) =~ s/.*:://; return if $method eq 'DESTROY'; if ($method eq 'child_method') { print "Child->child_method\n"; } else { $method = "SUPER::$method"; $self->$method(@_); } } ############### package Parent; sub AUTOLOAD { my $self = shift; (my $method = $AUTOLOAD) =~ s/.*:://; return if $method eq 'DESTROY'; print "Parent->$method\n"; } ############# package main; Child->child_method; Child->blah; __END__ Child->child_method Parent->blah
blokhead
In reply to Re: AUTOLOAD cascade
by blokhead
in thread AUTOLOAD cascade
by shemp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |