* Anthony Gardner <[EMAIL PROTECTED]> [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

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to