On Sun, May 31, 2009 at 06:06:48PM +0200, Matthias Dietrich wrote:
> Hi,
> 
> 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.  And the templates?  The only  
> way I know of is to copy and paste them into the 'root' folder of the  
> app.
> 
> There has to be a better way.  But which?

Just have your controller base class set:

$c->stash(additional_template_paths => $self->template_paths);

in a begin or auto or whatever action.

See Catalyst::Plugin::AutoCRUD for injecting extra components into the
various areas during application setup.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to