Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

using the Class::* Modules

by chorg (Monk)
on Apr 22, 2001 at 10:22 UTC ( #74542=perlquestion: print w/replies, xml ) Need Help??

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.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://74542]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-12-11 00:37 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.