Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Any one-liners for set and get functions?

by bart (Canon)
on Oct 05, 2007 at 08:13 UTC ( [id://642846]=note: print w/replies, xml ) Need Help??


in reply to Any one-liners for set and get functions?

There are modules on CPAN that can generatore them for you on the fly. A big one (and, at first sight, a rather complex one) is Class::Accessor. Will that do?

There may be more lightweight ones available, but there's none that jumps at me right now.

Yet, the principle isn't hard. Take a look at the source of WWW::Webrobot::Attributes for example: it's just one import routine, that generates a (combined getter/setter) sub for each attribute.

Replies are listed 'Best First'.
Re^2: Any one-liners for set and get functions?
by grinder (Bishop) on Oct 05, 2007 at 08:59 UTC
    A big one (and, at first sight, a rather complex one) is Class::Accessor.

    See Adam Kennedy's persuasive arguments as to why Object::Tiny is a better choice.

    • another intruder with the mooring in the heart of the Perl

Re^2: Any one-liners for set and get functions?
by moritz (Cardinal) on Oct 05, 2007 at 09:14 UTC
    Another module that might be helpful is Moose, which provides a complete OO implementation

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-20 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found