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

Anthony Gardner cyclewood_ltd at yahoo.co.uk
Tue May 15 09:00:31 GMT 2007


lib/MyAppDB is where you define your schema (your relations etc.) and lib/MyAppDB/Model is where you'd use them.

The latest long discussion on where your model should be is basically .... if your model is only fixed to the web application (blog etc), whack your model in lib/MyAppDB/Model. If, on the other hand your model will serve other functionality, then the model should be separate from the web application and lib/MyAppDB/Model should be used as a thin wrapper to this model.

Check out the discussion here ... it's a long link and goes off at different angles but you should get the idea.

http://readlist.com/lists/lists.rawmode.org/catalyst/1/7614.html

Have a look at this for another angle

http://www.teambarry.com/?p=38

I hope this helps.

-Ants



mla <maurice.aubrey at gmail.com> wrote: I just finished getting the tutorial project working.

The thing I'm not clear on is this separation between lib/MyAppDB/
and lib/MyApp/Model/

The tutorial says:

"With Catalyst::Model::DBIC::Schema you essentially end up with two sets 
of model classes (only one of which you write... the other set is 
created automatically in memory when your Catalyst application 
initializes). For this tutorial application, the important points to 
remember are: you write the result source files in MyAppDB, but within 
Catalyst you use the automatically created model classes in MyApp::Model."

So using DBIC::Schema, I would never create anything within the
lib/MyApp/Model directory, other than the MyAppDB.pm module?

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?

Is this how most of you structure your projects? Is there a way
to get the real models in lib/MyApp/Model?

Thanks.


_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/


 		
---------------------------------
 Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070515/9aaf9232/attachment.htm


More information about the Catalyst mailing list