in reply to Re^3: wat ::DESTROY will do
in thread wat ::DESTROY will do

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.

Replies are listed 'Best First'.
Re^5: wat ::DESTROY will do
by brian_d_foy (Abbot) on May 23, 2005 at 18:33 UTC

    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>