[Catalyst] Re: Shoot out -- Catalyst / RoR / Other MVC apps --

A. Pagaltzis pagaltzis at gmx.de
Thu May 10 15:14:14 GMT 2007


* Anthony Gardner <cyclewood_ltd at yahoo.co.uk> [2007-05-10 16:00]:
> Why not use Attribute::Protected to define private etc. methods

Because it does not actually prevent private methods in
subclasses from overriding ones in their superclasses, moves
error detection to compile time, adds overhead to every call,
and saddles you with yet another dependency.

Attribute::Protected turns subtle bugs into crashes, which is
a start when you have nothing better. But you do have something
better: using lexicals to store private methods *eliminates* the
problem entirely.

> Using 
> 
> my $my_method = sub {}
> 
> doesn;t that have a drawback if you want to use it before it's
> been defined?

That’s what BEGIN blocks are for. (And they’re always implicitly
there when loading a module.)

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle



More information about the Catalyst mailing list