[Catalyst] External plugins

Brandon Black blblack at gmail.com
Tue Feb 14 23:19:53 CET 2006


On 2/14/06, Brandon Black <blblack at gmail.com> wrote:
> On 2/14/06, Michael Richards <mdrichards at gmail.com> wrote:
> > On 2/14/06, Ovid <publiustemp-catalyst at yahoo.com> wrote:
> > > We have an app which uses Catalyst.  However, the plugins can
> > > theoretically not be Catalyst specific.  As far as I can tell, the only
> > > way to use a plugin which doesn't start with "Catalyst::Plugin::" is to
> > > do this:
> > >
> > >   use base 'Some::Plugin::In::Another::Namespace';
> >
> > Why not write a Catalyst::Plugin:: wrapper around your module? Many
> > (most?) Catalyst::Plugin modules are just that.
> >
>
> A lot of Catalyst::Plugin modules are indeed just simple wrappers
> around existing modules.  The issues with my modules in question is
> that:
>
> 1) They're really pure Catalyst Plugins, in the sense that there is no
> other non-Catalyst module being wrapped, and all of the meat of the
> code is highly Catalyst-specific.
>
> 2) They're also highly specific to my Cat application(s), so they
> don't really "belong" in the Catalyst:: namespace like the "official"
> plugins (and might in theory even conflict with some future plugin,
> although I've taken steps against that by making the plugins have
> names of the form Catalyst::Plugin::MyApplicationName::Foo).
>
> App-specific plugins seem like they would be a common design pattern
> to me for a sufficiently complex CatApp.  Much like with the official
> plugins, it allows you to cleanly seperate several functionally
> distinct bits of code that all need to hook into core Catalyst methods
> like ->process() - but they shouldn't really be in the Catalyst::
> namespace.
>

Hey, what about a Plugins (or short form "P") directory alongside
Model/Controller/View?  We could make that a sort of convention (don't
autoload them or anything), and when loading plugins by the usual
short names, check for MyApp::P::$plugin before checking for
Catalyst::Plugin::$plugin

-- Brandon



More information about the Catalyst mailing list