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

I'm about to sit down and write a bunch of classes, and I recall having seen some nifty looking modules to help in making new classes, but I can't seem to find them.

I've read the perlboot and perltoot and friends. I'm not so much looking for basics as I am for the cheats, tricks and hints that people are using right now today.

For instance, I think there's some sort of base object class that you can inherit from, specifying a list of getters and setters...

My real question is:

What modules do the monks use to help them make new classes?

Replies are listed 'Best First'.
Re: Object Helpers
by xdg (Monsignor) on Mar 06, 2006 at 22:41 UTC

    Class::Accessor is "popular" -- meaning that it's in the Phalanx list. Can't go wrong there.

    The latest "new" thing, is inside-out objects, which provide an easy route to strong encapsulation. See xdg's scratchpad for several links to posts about them. I wrote Class::InsideOut to make it easy to use them and you might want to give it a try. For a more advanced take, there's Object::InsideOut. (However, I don't recommend Class::Std until some bugs and limitations are addressed.)

    I'm sure others will suggest their favorites, too.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Object Helpers
by GrandFather (Saint) on Mar 06, 2006 at 22:59 UTC

    Class::MethodMaker is nifty for adding properties and getters/setters to a class.


    DWIM is Perl's answer to Gödel
Re: Object Helpers
by jeffa (Bishop) on Mar 07, 2006 at 01:24 UTC