Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-01 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (24 votes), past polls