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

John Napiorkowski jjn1056 at yahoo.com
Tue Dec 18 15:42:31 GMT 2007


--- "Christopher H. Laco" <claco at chrislaco.com> wrote:

> John Napiorkowski wrote:
> > --- Bogdan Lucaciu <bogdan at wiz.ro> wrote:
> > 
> >> On Tuesday 18 December 2007 04:39:36 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'm assuming that it's just a matter of tweaking
> >> the Module::Pluggable
> >>> search paths at the appropriate time when Cat is
> >> starting up.
> >>> Is this a planned feature for 5.8? Could it be?
> >>> Yes, I'll volunteer to put some tuits on it if
> >> need be.
> >>
> >> I would rather have this in the config.
> >> Even some Views/Models can be just in the config,
> as
> >> the files on disk are 
> >> sometimes mostly empty.
> > 
> > I'd also vote for the config, since I've had
> several
> > use cases of using one set of plugins in dev and a
> > subset of that on prod.  I'm sure I'm not the only
> > one.
> > 
> > -john
> 
> 
> And what if I want some models/views/controllers for
> dev vs. live?
> I wouldn't want to rely on config to do that either.
> But I get the point.

I think you're totally on with this, you probably
don't want to mutate the whole system to much,
probably bad practice to do so, but the plugins do
seem to be a special case, since I've seen lot of
places using the stacktrace plugin on dev and forget
to remove it for production...


> 
> I don't think they have to be mutually exclusive
> either. If you don't
> want to use the Plugins directory, don't put
> anything in it, and use
> config instead....and vice versa.
> 
> -=Chris
> 
That's true.  Myself I've been taking this approach in
lots of my code, mostly using the
MooseX::Object::Pluggable so that I can break out
functionality into discrete bits, and really loving
the approach.  I created a couple of base classes for
quickly building dispatchers and command chains from a
plugin namespace.

I like both approaches, see advantages and the lack of
mutual exclusiveness, but I'm wondering now about the
syntax and the potential for confusion with new users.

--john

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



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the Catalyst mailing list