[Catalyst] Modelling the right way

Matthias Dietrich mdietrich at cpan.org
Thu Sep 3 10:20:59 GMT 2009


the models in my past applications were quite small and if they need  
interaction with other models (like DBIC and stuff), I used  
ACCEPT_CONTEXT to either get the complete context object or part of  
it.  But all the models were related only to website parts and I  
didn't use them outside of catalyst.  But, one goal of models should  
be to be able to use them without catalyst, e.g. in cron jobs or other  

In a "proof of concept" app I'm building right now, I need the models  
to be usable outside, so I cannot rely on the context object to  
interact with other models and the database.  My idea is to build the  
modules with business logic completly independent from catalyst and  
use the models as thin wrappers around them.  With  
Catalyst::Component::InstancePerContext I'm able to construct these  
modules per request and pass the schema as parameter to new(), so the  
module could use the database for retrieving the required data.  As  
the other models are only wrappers, too, I could just 'use' the other  
modules inside one module and pass along the schema, too.

I'm interested if this way of "modelling" is acceptable, how you  
achieved this and what is considered best practice.


rainboxx Matthias Dietrich
Freier Software Engineer

rainboxx                  |  Tel.: +49 (0) 151 / 50 60 78 64
Tölzer Str. 19            |  Mail: matt at rainboxx.de
70372 Stuttgart           |  WWW : http://www.rainboxx.de

XING: https://www.xing.com/profile/Matthias_Dietrich18
GULP: http://www.gulp.de/profil/rainboxx.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: Signierter Teil der Nachricht
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090903/93306c0d/PGP.pgp

More information about the Catalyst mailing list