[Israel.pm] bless and AUTOLOAD

Yuval Kogman nothingmuch at woobling.org
Wed Sep 26 06:17:52 PDT 2007


On Wed, Sep 26, 2007 at 14:16:37 +0200, Shmuel Fomberg wrote:
> Hello There.
> 
> > Yuval Kogman Wrote:
> 
> >> sub UNIVERSAL::DESTROY {}
> >> And no worries.
> >
> >What if some class implements an AUTOLOAD that is specifically
> >interested in catching DESTROY?
> 
> That depends: if you are talking about a class that he wrote, then he can
> fix it. 
> But if you are talking about CPAN module, then the module simply should not
> do that. No, really. Because you are thinking about DESTROY, but what about
> CLONE? CLONE_SKIP? FETCH? Some new internal name FFDSGRE_DO for some new
> functionality? 
> Using AUTOLOAD in CPAN module is very dangerous, because the author can
> never know the surrounding conditions. But silently ignore all the capital
> letter functions and physically implement the ones that it needs is the
> basic requirement.

Polluting UNIVERSAL is much more dangerous IMHO

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418




More information about the Perl mailing list