[Catalyst] Best practice: How to build app parts reusable?
Eden Cardim
edencardim at gmail.com
Tue Jun 2 13:42:19 GMT 2009
On Sun, May 31, 2009 at 1:06 PM, Matthias Dietrich <mdietrich at cpan.org> wrote:
> in one of my Catalyst apps I'm building application parts that I want to
> reuse in other Catalyst apps where possible. What's the best practice to do
> that? I mean the complete parts from controller, to model, DBIC schema
> classes and templates.
>
> Let's assume one part is a guestbook (no, it's not but it's a funny example
> ;)). The integration of the controller class is very easy. I just would
> build a new controller inside the app which uses the guestbook controller as
> base class and sets the correct namespace, where the guestbook should
> appear. A similar procedure would get me the model and schemes into my app,
> but it requires a wrapper class for each class the guestbook brings with.
You don't really need a wrapper, you can shove all your classes into a
single namespace and selectively load the ones you want into your app
via $c->config->{setup_components} and the Module::Pluggable API.
> And the templates? The only way I know of is to copy and paste them into
> the 'root' folder of the app.
Assuming you're using Catalyst::View::TT, just change the INCLUDE_PATH setting.
--
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/
More information about the Catalyst
mailing list