Spent a bit of time googlilng this and apparnelty I'm not searching very
effectively today...



Short version:

What's best-practices to get model library sub-modules hooked in to the
main model?



Long version:

*catalyst.pl Thingy*
*cd Thingy*
*script/thingy_create.pl model DB DBIC::Schema \*
*   Thingy::Schema::DB create=static dbi:mysql:thingy \
*
*   dbuser dbpasswd*

So now we have lib/Thingy/Model/DB like so:

*package Thingy::Model::DB;*
*
*
*use strict;*
*use base 'Catalyst::Model::DBIC::Schema';*
*
*
*__PACKAGE__->config(*
*    schema_class => 'Thingy::Schema::DB',*
*   *
*    connect_info => {*
*        dsn => 'dbi:mysql:thingy',*
*        user => 'dbuser',*
*        password => 'dbpasswd',*
*    }*
*);*

This is a top-level module. Instead of a monolithic mess with all possible
library routines in one package, we want to modularize sub-functions into,
say

*Thingy::Model::DB::Team*
*Thingy::Model::DB::User*
*Thingy::Model::DB::Incident*
etc

Do we have those sub-modules "use" the top-level Thingy::Model::DB? Do we
have Thingy::Model::DB use the sub-modules?

Do we have the sub-modules "use base 'Catalyst::Model::DBIC::Schema'"? Or
can they just "extends 'Catalyst::Model'" and if so how do they hook in
with $c?

Is there an elegant way to have all the sub-module models use the same DB
config as the top model?

...or...

What's the best practice for getting separate modules to work as models in
the MVC universe?

-- 
 Will Trillich :: 812.454.6431

“Grading takes away all the fun from failing. And a huge part of education
is about failure.”  -- Shimon Schocken
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to