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?? |
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.
In Section
Seekers of Perl Wisdom
|
|