[Catalyst] More new shortcuts

Sebastian Riedel sri at oook.de
Sun Nov 6 23:47:15 CET 2005


Am 06.11.2005 um 23:15 schrieb radium:

> On 11/6/05, Sebastian Riedel <sri at oook.de> wrote:
>
> Am 06.11.2005 um 21:18 schrieb Jules Bean:
>
> > Sebastian Riedel wrote:
> > Some people recommend not to inherit from any of these for your
> > model class, so that the model can be used outside Catalyst in
> > batch scripts etc.
>
> What makes a Catalyst::Model subclass unusable outside of Catalyst?
>
>
> You could have a machine without Catalyst installed that has an  
> older perl interpreter that my model works with but Catalyst won't.
>
> More importantly, what is the benefit of inheriting from  
> Catalyst::Model?  I write my own model base class and inherit from  
> that, just because I find CDBI and other base classes are often too  
> abstract and too magical for me to control performance-wise.  It's  
> easier for me to write efficient model code when I know precisely  
> what is happening.  Am I missing out on something by not inheriting  
> from Catalyst::Model?

Your example is a bit...obscure...

You would just miss the Catalyst-isms making your life a bit easier.
But why not just use this?

     package MyApp::Base::DBIC;
     use base 'DBIx::Class';
     1;

     package MyApp::Model::DBIC;
     use base qw/Catalyst::Model MyApp::Base::DBIC/;
     1;

It's all just best practices, nothing is enforced.

--
sebastian




More information about the Catalyst mailing list