$subclass->new_meth will set $AUTOLOAD to "SUBCLASS::new_meth" so will install the closure there. If later I call $other_subclass->new_meth then I'll get another sub in OTHERSUBCLASS::new_meth.
"Doctor, it hurts when I do this" :-)
Put it in the base class - this should do what you want:
sub AUTOLOAD { my ($fn) = ($AUTOLOAD =~ /^.*::(.+)$/); return if $fn eq 'DESTROY'; *{$fn} = sub { print "$AUTOLOAD $fn\n"; }; goto &$fn; }
In reply to Re^3: AUTOLOAD & mod_perl memory
by adrianh
in thread AUTOLOAD & mod_perl memory
by bsb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |