in reply to Best Practice: Catalyst and DBIx::Class
What many of us do, probably most of the experienced Cat devs, is to keep the schema separate from the Cat app, though often in the same namespace. So you have MyApp::Schema and MyApp::Schema::Tables or MyApp::Schema::FatModel and then your model class is nothing but an import of the schema with some connection information for the application.
package MyApp::Model::DB; use strict; use base qw/ Catalyst::Model::DBIC::Schema /; __PACKAGE__->config ( schema_class => 'MyApp::Schema', # et cetera
It can be confusing at first because the abstractions are pretty deep but it's very powerful and lets you reuse your schema anywhere (command line, standalone service, one-offs) without loading your app since it ignores anything outside the M/V/C namespaces.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best Practice: Catalyst and DBIx::Class
by confused_elf (Novice) on May 07, 2008 at 09:59 UTC |