chorg has asked for the wisdom of the Perl Monks concerning the following question:

So I'm going to make some objects

I want to use one of the Class::* modules to make my life simpler re. acessors. It's great that these classes do that, but where do they put the accessors? How would I modify them?
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

Replies are listed 'Best First'.
Re: using the Class::* Modules
by stephen (Priest) on Apr 22, 2001 at 11:09 UTC
    I'll assume that you're talking about Class::MethodMaker. MethodMaker defines its methods on-the-fly when the class loads. When you ask "where do they put the accessors?", do you mean "where is the accessor implementation written out to a file?"? If that's what you mean, the accessor implementation isn't written out to a file-- it's just evaluated at compile-time.

    To modify these methods, you just need to define your own. To quote from the perldoc:

    To override any generated methods, it is sufficient to ensure that the overriding method is defined when Class::MethodMaker is called. Note that the use keyword introduces a BEGIN block, so you may need to define (or at least declare) your overriding method in a BEGIN block.