[Catalyst] catalyst tutorial: MyAppDB/Book.pm vs. MyApp/Model/Book.pm

Matt S Trout dbix-class at trout.me.uk
Tue May 15 09:05:11 GMT 2007


On Mon, May 14, 2007 at 06:22:36PM -0700, mla wrote:
> All the real models live in lib/MyAppDB? And if I wanted to use a
> model *outside* catalyst, I'd use MyAppDB::Book, but within
> catalyst it would be MyApp::Book?

well, $c->model('MyApp::Book') if your DBIC::Schema was Model::MyApp.
 
> Is this how most of you structure your projects? Is there a way
> to get the real models in lib/MyApp/Model?

It is, and you don't -want- to put them in there - mine usually live in
MyApp::Schema or similar. The point is the DBIC::Schema model is an
-adapter- that brings an external model into your app; the DBIC stuff can
then be installed and used separately for backend processing etc. without
needing all the Catalyst machine installed/loaded.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list