Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: (Zigster) Re: Re: Perl and Objects, how do you resolve the two?by stephen (Priest) |
on Apr 10, 2001 at 23:09 UTC ( [id://71451]=note: print w/replies, xml ) | Need Help?? |
Ah, I think I see where the misunderstanding lies. You ("you" meaning zigster) are assuming that I'm autogenerating methods based on the underlying object implementation. That's not what I'm talking about. I'm talking about generating methods based on some other standard, like so: Note: code based on working code and Camel, but untested And in other code... Then, I can add accessors by merely messing with the %ACCESSOR_TABLE, and not defining more subroutines. This is particularily useful for objects which are loaded from databases-- I can add new fields to the database without doing as much recoding. If there are accessors that don't store their data in '_data_table', I can define them separately, or just add some functionality to AUTOLOAD. These are implementation details; I just want to show that there are legitimate uses for AUTOLOAD in an object-oriented context. And once again, this illustrates the power of OO. From the perspective of the class user, it doesn't matter whether I've defined individual subroutines or if I've got them autoloaded instead. The class user doesn't need to understand "what is under the hood." stephen Update: Added an 'accessor exists' check.
In Section
Meditations
|
|