[Pdx-pm] Seven Sins of OO Perl

chromatic chromatic at wgz.org
Sat Sep 24 12:33:00 PDT 2005


Hi all,

As promised, here's my list of guidelines for OO Perl from the talk
earlier this month:

1) Don't call methods as functions (especially methods in UNIVERSAL)
2) Don't use AUTOLOAD() to generate methods unless you know the four
things you need to do to make it work reliably
3) Don't use indirect object method calls, even for constructors
4) Access instance data directly only from accessor methods
5) Don't forbid inheritance from your classes
6) Use Test::Class to make everyone's life easier
7) Don't use inheritance when aggregation, delegation, roles, or mixins
would do

Good coding,
-- c



More information about the Pdx-pm-list mailing list