[Catalyst] sub-modules for model
will trillich
will.trillich at serensoft.com
Wed Dec 19 17:53:32 GMT 2012
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=3Dstatic 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 =3D> 'Thingy::Schema::DB',*
* *
* connect_info =3D> {*
* dsn =3D> 'dbi:mysql:thingy',*
* user =3D> 'dbuser',*
* password =3D> '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
=93Grading takes away all the fun from failing. And a huge part of education
is about failure.=94 -- Shimon Schocken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20121219/512a1=
0aa/attachment.htm
More information about the Catalyst
mailing list