Once perl finds a real method, it doesn't have to go back through @ISA looking for AUTOLOADs. Also, you don't have to make DESTROY a special case. Avoid special cases when possible.
--
brian d foy <brian@stonehenge.com>
| [reply] |
Unless someone else's AUTOLOAD will handle DESTROY...
Since, as you know, all other packages automatically derive from UNIVERSAL, if one of them uses AUTOLOAD to handle DESTROY, which is odd in and of itself, your UNIVERSAL::DESTROY method will short-circuit that since, as you say, perl will find UNIVERSAL::DESTROY before looking for Some::Package::AUTOLOAD.
| [reply] |
Packages don't really derive from UNIVERSAL: it's just the last entry in @ISA. It's not like Object in Java or some other languages. UNIVERSAL will always be after everything else.
It's true that some other AUTOLOAD may handle DESTROY, and in that case you wouldn't want to do that. I typically don't let AUTOLOAD handle special methods like DESTROY, though.
--
brian d foy <brian@stonehenge.com>
| [reply] |