Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
On Thu, Dec 20, 2007 at 10:21:37AM -0500, Christopher H. Laco wrote: > 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. > > > > -=Chris > > Just for giggles this morning, I started tinkering with a > Catalyst::Plugin::PluginLoader. > > Can anyone in core tell me why things are in this particular order? > > setup { > $class->setup_plugins > $class->log->debug( "Loaded plugins:\n" . $t->draw . "\n" ); > ... > # Call plugins setup > { > no warnings qw/redefine/; > local *setup = sub { }; > $class->setup; > } > } > > > Since PluginLoader->setup is called after the Debug "loaded plugins" > output...it doesn't show the plugins just loaded by PluginLoader. > > Is there some reason these are backwords on purpose, or is that just a > bug? It appears that other things are ok Can't see a reason really, except maybe "what if we die loading a plugin", but then you'll get an error anyway. Unless somebody else objects I'd say patch it. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
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. > > -=Chris Just for giggles this morning, I started tinkering with a Catalyst::Plugin::PluginLoader. Can anyone in core tell me why things are in this particular order? setup { $class->setup_plugins $class->log->debug( "Loaded plugins:\n" . $t->draw . "\n" ); ... # Call plugins setup { no warnings qw/redefine/; local *setup = sub { }; $class->setup; } } Since PluginLoader->setup is called after the Debug "loaded plugins" output...it doesn't show the plugins just loaded by PluginLoader. Is there some reason these are backwords on purpose, or is that just a bug? It appears that other things are ok $class->log->debug( "Loaded components:\n" . $t->draw . "\n" ) happens after setup_components etc... Aside from that...just loading plugins from ::Plugin or ::P works, along with the same search_extra kinds of things setup_components does. Justs needs tests and pod. -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
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. > > -=Chris Just to keep the conversation rolling, let's put aside the Plugins directory for the moment. If you wanted to load plugins from config, what would you like to see? What would you need? 1. Load all plugins specifically from config, ignoring what's in MyApp.pm when specified? plugins: - ConfigLoader - Session - Session::State::Cookie - Session::Store::File - +MyApp::Plugin::Frobnisicate - Static::Simple 2. Load plugins from a location? plugins: path: __path_to(lib, MyApp, Plugins) 3. Prepend/Append plugins to be loaded around MyApp.pm? plugins: prepend: - Debug append: - Static::Simple - +MyApp::Plugin::Foo -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
--- "Christopher H. Laco" <[EMAIL PROTECTED]> wrote: > John Napiorkowski wrote: > > --- Bogdan Lucaciu <[EMAIL PROTECTED]> 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 insteadand 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@lists.scsys.co.uk > Listinfo: > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[EMAIL PROTECTED]/ > 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 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
John Napiorkowski wrote: > --- Bogdan Lucaciu <[EMAIL PROTECTED]> 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 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 insteadand vice versa. -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
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. -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
--- Bogdan Lucaciu <[EMAIL PROTECTED]> 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 > > -- > Bogdan Lucaciu > http://www.wiz.ro > > ___ > List: Catalyst@lists.scsys.co.uk > Listinfo: > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[EMAIL PROTECTED]/ > Dev site: http://dev.catalyst.perl.org/ > Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
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 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins
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. -- Bogdan Lucaciu http://www.wiz.ro ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/