|There's more than one way to do things|
AUTOLOAD - the good, the bad, and the uglyby shemp (Deacon)
|on Oct 14, 2004 at 18:13 UTC||Need Help??|
This post is in response to all the very interesting responses i got to my recent AUTOLOAD post: AUTOLOAD cascade
Basically I'm trying to get an understanding on what people use AUTOLOAD for in general, and what is considered good practice (holy war to follow). There are a lot of *interesting* things that can be done with AUTOLOAD, but as i get deeper, i keep finding conflicting opinions / reasons as to AUTOLOAD or not to AUTOLOAD.
It's a nice timesaver to use it to handle simple accessor / mutators without having to write them explicitly:
But if you're inheriting from this class, you definitely need to know too much detail about the implementation, particularly that its using AUTOLOAD for some accessor / mutators.
As was sort of talked about in my other thread, perhaps a better way to do this is along the lines of:
This way, these accessor / mutators are in the symbol table, and will be looked up faster, will be found by can(), etc. This avoids the inheritance problem from the other post too.
Perhaps part of my problem is that a lot of my ideas come from Damian Conways 'Object Oriented Perl' (Manning 2000), which is perhaps outdated.
Or maybe AUTOLOAD can be used for a lot of neat tricks in little scripts, but becomes quite annoying for large software projects.