in reply to Re^4: Trying to understand Catalyst::Model::Adaptor
in thread Trying to understand Catalyst::Model::Adaptor
Oh, sure. There is a way to do that which buys you, in general, the best of both worlds.
Something I do in most apps is keep parallel directories for agnostic parts of the application. The DB schema for example. I almost always use DBIx::Class. I put it parallel to the MVC parts. E.g.,
MyApp::Controller MyApp::Model MyApp::View MyApp::Schema (or MyApp::DBIC or whatever) MyApp::SomeSpecialTextTransforms MyApp::ExternalWebservice
Then only the MVC are directly tied to the web app and the other parts are generic modules which can be used without the app context ($c).
I also generally keep a MyApp/bin for scripts I write that are not directly related to the web app and put scripts that are in the MyApp/scripts with the usual suspects.
The extra classes are hooked into your web app through Model glue. Some are all but done for you, like Catalyst::Model::DBIC::Schema. Others you typically ride in on Catalyst::Model::Adaptor like we were discussing. This way the customizations you make to things are available to all your code in the most natural way and you only have to (in the best case) ever edit code in one place to get the changes to propagate everywhere you want. The single drawback to this is the Catalyst configuration system is too tightly bound to the application. There have been discussions about fixing this but no motion so far.
Good luck and have fun!
(update: spelling fixes.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Trying to understand Catalyst::Model::Adaptor
by tospo (Hermit) on Apr 07, 2010 at 20:54 UTC | |
by Your Mother (Archbishop) on Apr 07, 2010 at 22:37 UTC | |
by tospo (Hermit) on Apr 08, 2010 at 08:48 UTC | |
by Your Mother (Archbishop) on Apr 08, 2010 at 23:17 UTC |