in reply to How many ways are there to use AUTOLOAD?
Now if you call handled_func() on a child object, child::AUTOLOAD will *handle* it by logging the warning, when you probably wanted parent::AUTOLOAD to actually deal with the method callpackage parent; ... sub AUTOLOAD { our $AUTOLOAD; return if ( $AUTOLOAD =~ /DESTROY$/ ); if ( $AUTOLOAD eq 'handled_func' ) { # do something return; } $logger->warn("Tried to call $AUTOLOAD."); } ... package child { ... sub AUTOLOAD { our $AUTOLOAD; return if ( $AUTOLOAD =~ /DESTROY$/ ); $logger->warn("Tried to call $AUTOLOAD."); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How many ways are there to use AUTOLOAD?
by talexb (Chancellor) on Jul 20, 2004 at 20:26 UTC |