bsb has asked for the wisdom of the Perl Monks concerning the following question:
sub AUTOLOAD { ... *{$AUTOLOAD} = sub { ... }; goto &$AUTOLOAD; }
However, I think that code installs it into each sub-class. Installing it in the base class would be better and easy enough, but I'm more concerned about whether I should be doing it at all under mod_perl. According to my "mod_perl guide" brain-washing, you should avoid importing symbols to save memory. So why not just do it in AUTOLOAD? (performance vs memory???)
sub AUTOLOAD { my($attr) = $AUTOLOAD =~ /^.*::(.+)$/; return $_->{$attr}; }
I really should just do some testing...
This code isn't in production so can be changed freely.
Thanks, Brad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AUTOLOAD & mod_perl memory
by perrin (Chancellor) on Dec 03, 2002 at 05:06 UTC | |
by bsb (Priest) on Dec 03, 2002 at 05:21 UTC | |
|
Re: AUTOLOAD & mod_perl memory
by pike (Monk) on Dec 03, 2002 at 13:43 UTC | |
by bsb (Priest) on Dec 04, 2002 at 00:31 UTC | |
by adrianh (Chancellor) on Dec 04, 2002 at 00:54 UTC | |
by bsb (Priest) on Dec 04, 2002 at 02:27 UTC | |
by pike (Monk) on Dec 04, 2002 at 20:27 UTC |