[Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins

Christopher H. Laco claco at chrislaco.com
Tue Dec 18 13:42:14 GMT 2007


Ash Berlin wrote:
> =

> On 18 Dec 2007, at 02:39, Christopher Laco wrote:
> =

>> I know I've been down this thread before. When writing a framework that
>> generates customized Catalyst apps, it would be a whole lot easier
>> (well, more proper) to add plugins in lib/MyApp/Plugins, just like we do
>> with controllers/models/view, than it is to molest the MyApp.pm 'use
>> Catalyst' line to include custom plugins.
> =

> I don't quite see the point of this. Why not just add methods to
> MyApp.pm? (I'm guessing there might actually be a sane reason for you
> not wanting to do it this way, but I can't grok what it is)
> =

> Ash

Mainly, because there is no automated, programmatic way to add plug ins
to a generated Cat app without editing code.

The scenario is:

	mango.pl MyApp

which in turn, uses $helper->mk_app, just like catalyst.pl MyApp does.
After that point, my scripts can add models, view and controllers just
dandy, but there's no way to add plugins unless I literally open
MyApp.pm in the script, and do:

    s/
       ConfigLoader StaticSimple
    /
       ConfigLoader
       MyApp::Plugin::Foo
       OtherApp::Plugin::Bar
       Static::Simple
    /

That's nasty at best and will fail eventually when the defaults change.
I can add models/view/controllers by dropping files in the correct
directories, why not plugins?

Aside from Mango, anyone who generates Cat based apps automatically when
accounts are created (like virtual hosts...MediaTemple) may want or need
to also install default plugins. Just dorpping them in a Plugins
directory just like M/V/C makes more sens than trying to automatically
edit code in my book.

-=3DChris



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20071218/77bc=
31f5/signature.pgp


More information about the Catalyst mailing list