On Thu, Aug 27, 2009 at 11:10 PM, Daniel Austin<[email protected]> wrote: > Hello > > How are you handling configuration for applications or code that run > outside of Catalyst? > > For example, in my model tests, I have code like this: > > use MyCompany::CatApp; > my $app = MyCompany::CatApp->new(); > my $model = $app->model('DB::Model')->new({}); > ok( $model->insert ); > > etc. > > This way the model tests are talking to the right database as > configured for that environment. But it seems slow to run and it's not > the right coupling if I have, say, a cronjob that wants to use the > same models. > > Are there any patterns anyone can recommend?
Catalyst::Model::DBIC::Schema is just an adaptor for loading a DBIC::Schema inside a catalyst application. You can "use MyApp::Schema::DB" anywhere outside your catalyst application, see DBIx::Class::Schema for how to connect your schema to a database backend without the help of C::M::DBIC::Schema. Besides that, I've just finished writing code for $work that does a few hacks to use Catalyst::Plugin::ConfigLoader outside the context of a catalyst application. it's a temporary solution, my opinion is that there should be an external module for use by any application, not just cat, and the plugin should just hook that module into Catalyst. -- Eden Cardim Need help with your Catalyst or DBIx::Class project? Code Monkey http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://edenc.vox.com/ http://www.shadowcat.co.uk/servers/ _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
