664, 668 - Getopt::Long
Ovid
publiustemp-tapx at yahoo.com
Fri Oct 5 00:11:44 BST 2007
--- Andy Armstrong <n at rciss.us> wrote:
> I've just noticed this:
>
> ( App::Prove::Plugins->can('switches')
> ? App::Prove::Plugins->switches
> : ()
> ),
Side note regarding proper OO.
In the above case, inheritance is warranted with an abstract base class
for plugins:
package App::Prove::Plugins::Base;
sub switches {}
And all plugins inherit from that and you can just properly call the
switches method without the ternary operator.
A good rule of thumb for OO programming is to grep for "if" statements
and look for the design flaw.
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/
More information about the tapx-dev
mailing list