«Extending Catalyst» Documentation

Comments

I dig the new content. The one question I had in my mind after reading it was "When should I use custom Actions instead of subclassing base controllers?"
Good question. I'm afraid «When it's appropriate» doesn't count as an answer :) I think something along the lines

Use an action class when you want to act on a single action's execution and a controller base class when you want to provide functionality or defaults for the whole controller.
might be a good fit. I'll try to work something in.

Thanks for the comment!
.phaylon
Also, re: namespaces and not polluting Catalyst::*...

Does the +Full::Class::Name work everywhere? Even in catalyst.pl and such?
Things like View Helpers that are namespaced into Catalyst::* so they just work...

I'd bet that some of the things that pollute Catalyst::** are that way because people just don't realize full path names work... or that sometimes you need to use a + and sometimes you don't.

Are there any rules about what non-core things can go in Catalyst::*?
Of course, I'm guilty. What about Models?
There was a bit of a discussion about what to put into CatalystX:: and what into Catalyst::. I've put the "when you can" in mostly as safety net. With Catalyst::Helper:: it's surely mandatory, just like Catalyst::Plugin:: is. The last consent I remember was plugins, models, views and controllers are fine to "pollute," but everything else under Catalyst:: might conflict with some future stuff.

I'll ask the #catalyst-dev metamind tomorrow on this issue, but I guess it will be a list of preferable namespaces, like Catalyst::Model:: for models, Catalyst::View:: for views, Catalyst::Helper:: for helpers, Catalyst::Controller for controllers and Catalyst::Plugin for plugins. Everything else will probably go under CatalystX. I'm unsure about Catalyst::Component:: and Catalyst::Example.

I will probably add another clarifying post once I got core to agree on something and patched the docs.

Thanks again, these comments are exactly what I was looking for! :D
.phaylon
Just for giggles, I'm taking a different approach in Mango, one that lends itself to avoiding Catalyst::* altogether.

My catalyst base classes are in Mango::Catalyst::*, and since I'm not exposing any Helper magic (one will use mango.pl to create an app instead of using create.pl helper magic), everything should stay nice and tucked away in there. MyApp::* stuff just inherits from there, and since plugins can be loaded using +, all is well.

I'm surprised that create.pl doesn't JustFork with +Full::Class::Names. Maybe that's a nice TODO.

Post a comment

Already a Vox member? Sign in

phaylon

About Me

phaylon
Germany
Ordinary morality is for ordinary people.

Neighborhood

Explore friends, family, friends & family, or entire neighborhood.

Archives