[Catalyst] Multiple Chain Actions
Derek Wueppelmann
dwueppel at gmail.com
Fri Jul 17 20:53:18 GMT 2009
On Thu, 2009-07-16 at 20:22 +0100, Tomas Doran wrote:
> package MyApp::Controller::JSON;
> with 'MyApp::Stuff';
> sub root : Chained('/') PathPart('json') CaptureArgs(0) {}
>
> Will give you:
>
> /thingie
> and
> /json/thingie
This seems to be a decent option. However this will result in a fair
number of mostly empty modules being created. For example to get:
/object/$ID/update
/json/object/$ID/update
I would have to create a module that just contained:
package MyApp::Controller::JSON::Object;
with 'MyApp::ObjectStuff';
sub root : Chained('/') PathPart('json/object') CaptureArgs(0) {}
Since there will be nothing else to add to this, in most cases.
Is there a way to use multiple methods to achieve something similar.
Somting like this:
sub root : Chained('/json') PathPart('object') ChainedArgs(0) { ... }
sub update : Chained('root') PathPart('update') Args(0) {
$c->forward(...)
}
sub update_json : Chained('object') Args(0) {
$c->forward(...)
}
--
o) Derek Wueppelmann (o
(D . dwueppel at gmail.com D).
((` http://www.monkeynet.ca ( ) `
More information about the Catalyst
mailing list