Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Re: Re: Strange code execution with 'AUTOLOAD'

by btrott (Parson)
on Jul 02, 2001 at 04:38 UTC ( #93084=note: print w/ replies, xml ) Need Help??

in reply to Re: Re: Strange code execution with 'AUTOLOAD'
in thread Strange code execution with 'AUTOLOAD'

Yes, this is the second option presented in OOP that I mentioned. :)

However, as Damian Conway writes (and as you note), calling AUTOLOAD when you mean DESTROY, and when you *know* what you want to do with DESTROY, is less efficient than just defining an empty DESTROY method with

sub DESTROY { }
As for ease of maintenance, I would make the case that it is just as easy to maintain an empty method stub as a special case in AUTOLOAD, if not easier. And it is certainly clearer when looking at the code: rather than destruction behavior being buried in the definition of an AUTOLOAD, you have a defined DESTROY method to show that there is, in effect, no special destruction code.

Comment on Re: Re: Re: Strange code execution with 'AUTOLOAD'
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://93084]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2015-11-26 11:02 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls