in reply to Re (tilly) 2: Perl and Objects, how do you resolve the two?
in thread Perl and Objects, how do you resolve the two?
The way one uses that module is to inherit it through @ISA. Then, $self->get(-FOO) works quite nicely. $self->exists(-FOO) is included primarily for completeness than a real need for it. You don't Export the functions. (The only function I really want to Export is define_attributes, but I'm having problems getting define_attributes within the scope of grandchildren and further down. Any thoughts?)
I still return to my main objection concerning AUTOLOAD being that it's much less maintainable. I inherited this project and (hopefully!) will be passing it on to someone else in the next 6-8 weeks. If I was passing on an application containing some 250 classes, every single one of them having their own AUTOLOAD, that's a maintenance nightmare! This way, the accessor methods are defined in one, and only one, place. Every object has the exact same API, meaning that learning the system is very easy. (Yes, learning $self->foo() is also easy. I'm whining. But, having the API to within the objects be consistent is still a "Good Thing"(tm).) I hand this off and my successor doesn't have to fight the implementation. That is also a "Good Thing"(tm).
Yes, there are things that AUTOLOAD is good for. I would put forward that a production application isn't one of them.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 4: Perl and Objects, how do you resolve the two?
by tilly (Archbishop) on Apr 11, 2001 at 20:26 UTC | |
by satchboost (Scribe) on Apr 11, 2001 at 22:05 UTC |