Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Class::MethodMaker, CPAN and alternatives

by anithri (Beadle)
on Aug 27, 2002 at 22:20 UTC ( [id://193295]=perlquestion: print w/replies, xml ) Need Help??

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

I often use Class::MethodMaker to generate accessors/mutators for my private use. However now I am preparing a module that will be uploaded to CPAN and am wondering if it is okay to use Class::MethodMaker in packages destined for CPAN.

Assuming for a moment that's it's uncool (as it's an additional module requirement and adds cycles to compiletime. Is there a similar module that auto-generates modules, but outputs them as text? that way I could use the module once to generate the module, but then I wouldn't be dependednt on it at compiletime.

  • Comment on Class::MethodMaker, CPAN and alternatives

Replies are listed 'Best First'.
(jeffa) Re: Class::MethodMaker, CPAN and alternatives
by jeffa (Bishop) on Aug 28, 2002 at 01:48 UTC
    In your Makefile.pl file, you can add dependencies like so:
    use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Foo::Bar', 'VERSION_FROM' => 'Bar.pm', 'PREREQ_PM' => { Class::MethodMaker => 1.06 }, );
    If the user is using the CPAN shell, it will prompt them if they want to queue and install Class::MethodMaker. I am sure that CPANPLUS will do this as well, but i have not tested it myself.

    Class::MethodMaker is, IMHO, a wonderful module - but it is not the fastest way to use classes (for a processor, that is). Depending upon the number of classes you have to create, you might just want to go ahead and explicitly write the accessor methods yourself, if you think you won't have to do a lot of maintenance (yeah, right).

    As for your second question, i know of no modules that will output the class as a text file ... sounds like a really good idea though. I like it. I recommend you check out the POOP mailing list. miyagawa is an active particpant, he might have more info for you.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Class::MethodMaker, CPAN and alternatives
by TStanley (Canon) on Aug 28, 2002 at 11:11 UTC
    One of the monks here has written a book that covers a great deal of information on this particular subject, and he mentions the Class::MethodMaker module as well.

    TStanley
    --------
    Never underestimate the power of very stupid people in large groups -- Anonymous

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-23 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found