Correctness, is good. But hiding where a routine was called from is not correct.
It may be, for certain values of "correct" :-)
If I autoload methods that log (as an example of use of) caller() information, I would not like seeing in my logs:
My::Lazy::method called from My::Lazy::AUTOLOAD [... later ...] My::Lazy::method called from Some::Other::method [... and ...] My::Lazy::method called from Yet::Another::method
While correct, in a sense of the word, the information given in the first of these lines is not useful. And I don't want to make AUTOLOAD smart enough to know what to do with caller information in every case. That would defeat the purpose of AUTOLOAD. And so, I use goto instead.
With goto, I get the caller information I would get if I were not using AUTOLOAD.
If your correctness criterion is that the sub should behave as if it was already in existence, and not autoloaded, then goto provides that correctness.
The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"
In reply to Re: Re: Re: Re: Re: oop - obvious AUTOLOAD question
by Sidhekin
in thread oop - obvious AUTOLOAD question
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |