Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello, you receive for sure good replies, but even if i'm not a ObjectOrientedMonk (read Damian Conway's ten rules for when to use OO), i recall that some framework for OOPerl gives theese method for free if you want: Moose and Moo.
In a very lazy and minimalist perspective i recall also a good trick to have the setter and getter method for free without extra packages using the AUTOLOAD (a Perl mechanism that intercepts all possible undefined method calls) trick: If i remember this code is from the old but still worth reading book Perl CookBook. In this book an entire chapter is dedicated to Object but starting from the very primitive concepts (the book is aged). Even in the recent and very good book Modern Perl ther is tha chapter object oriented Perl that is very interesting. About your other general questions... is a matter of aptitude i think. Remember also that an OO Perl program is generally slower than a normal one. Anyway setter and getter methods are needed if you want do something with that fat Object. And yes OO is a general way of thinking to data and behaviours and relationships. Here at Perlmonks is a subject discussed many times: see super search: ?node_id=3989;HIT=object;re=N;BR;MR;M (notabely The Power of Objects Object-Oriented Perl - Introduction in The Perl Review Object Oriented Perl - very basic guide When to Use Object Oriented approach in Perl? (RFC)) HtH L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS. In reply to Re: OOP's setter/getter method - is there a way to avoid them?
by Discipulus
|
|