[Catalyst] $c->comp($name) fails to return the correct class
Matt S Trout
dbix-class at trout.me.uk
Sat Sep 24 17:29:01 CEST 2005
On Sat, Sep 24, 2005 at 11:08:33PM +0800, Alan Tam wrote:
> Matt S Trout wrote:
>
> >my $comp = $c->comp('M::Book$');
> >
> >This is the approach I use and not only works for Class::DBI stuff but
> >means
> >your components get a head-start on portability between apps.
> >
> Unfortunately other classes, like Scaffold, would still call $c->compin
> their own way.
>
> But if it is my own code, why not just use a string to represent the class.
Re-usability, as I already mentioned. Plus the fact that $c->comp will
return an instantiated object with the appropriate config if the class
inherits from Catalyst::Base - and the fact that having one standard
convention throughout my code makes life easier.
--
Matt S Trout Specialists in perl consulting, web development, and
Technical Director UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list