[Catalyst] RESTy Chained actions

Tomas Doran bobtfish at bobtfish.net
Tue Jun 29 15:02:20 GMT 2010


On 29 Jun 2010, at 14:43, Stephen Howard wrote:

> I may be off the mark on what you're trying to do, but here goes.
>
> In my brief experience with catalyst, inheritance doesn't do much  
> for you when constructing actions.
> I believe that chained actions are pretty tightly bound to the urls  
> you are building, so there's no way to reuse them for different urls.

Entirely incorrect.

> That said, something I often do is $c->forward my way to common  
> private functions, rather than try to do it through inheritance.   
> So, from that same project:

<snip gross solution which follows>

You can compose the actions you want to override from a role (or  
superclass, or whatever), and then use config to override the paths.

Here's an example (note the code here is simplistic / prototype, but  
it shows the concept):

http://github.com/bobtfish/Kaizendo/blob/master/lib/App/Kaizendo/Web/Controller/Project.pm

Cheers
t0m




More information about the Catalyst mailing list