[Catalyst-dev] Extensible Catalyst Applications: How?!

Peter Karman peter at peknet.com
Tue Jun 2 17:14:45 GMT 2009


Ido Perelmutter wrote on 6/2/09 5:45 AM:
> Hi everyone.
> 
> For the last week and a half I've been trying to figure out how to make my
> Catalyst application extensible, to no avail.
> 
> SCENARIO:
> 
> 1. I have written a Catalyst application called MyApp (The name is a
> trademark belonging to me so don't steal it).
> 
> 2. I want people (and me too) to be able to create plugins that extend the
> functionality of MyApp.
> 
> 3. I want to create a plugin for MyApp, called "MyPlugin". This plugin in
> itself is a (near-)complete Catalyst application. It has its own controllers,
> models, views, etc.
> 

Ido,

First, the word "plugin" is overloaded in this email, so it's difficult for me
to tell whether you mean plugin in the Catalyst::Plugin::* sense or in the more
general "drop-in feature extension" sense. I'm going to assume the latter, since
the former just makes No Sense to me at all.

Second, I too have tried various approaches to the idea of a base Catalyst app
that can be installed and easily extended by the user. The solution that I've
come up with (for now) is the style I use in CatalystX::CMS, where I have a base
Model, View, Controller and Action class, and some examples of how to use them
in your own application. The same goes for CatalystX::CRUD::YUI, which is a
full-featured CRUD app for use with DBIC or RDBO. I use
Catalyst::Plugin::Static::Simple::ByClass to serve static assets (css/js/img)
that are distributed with each package.

The approach I've settled on is a "some assembly required" pattern, with some
standard Helper classes to generate the basic .pm files. This isn't as turn-key
as some people like; otoh, it makes it much easier to extend and override the
basic functionality, since there's nothing magical about the base classes.

good luck,
pek

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com



More information about the Catalyst-dev mailing list