[Catalyst] RFC: Chained actions with PathPart('.')
Brian Kirkbride
brian.kirkbride at deeperbydesign.com
Thu Mar 22 18:46:08 GMT 2007
Hello all,
I've been working with Chained actions, and like many others have found the=
m to =
be incredibly useful for setting up DBIC result sets before reaching an end=
point.
The one thing that has been bothering me is that to start a chain in some =
controller, say MyApp::C::Admin::Services you would need to declare:
sub get_id : Chained('/') : PathPart('/admin/services') : CaptureArgs(1)=
{
# stash the id or do some lookup
}
It's most likely my ignorance showing, but this seems redundant and not ver=
y =
DRY. That's why I'd suggest that PathPart('.') set a chained action's Path=
Part =
to the namespace on the controller. That way you could simply do:
sub get_id : Chained('/') : PathPart('.') : CaptureArgs(1) {}
Renaming controllers or moving the action to a new controller automatically =
updates the leading path to the start of the chain. I assume that this wou=
ld =
only make sense if the Chained attribute is '/'
I've attached a patch implementing this change, comments or criticisms much =
appreciated.
Best,
Brian Kirkbride
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PathPart.diff
Type: text/x-diff
Size: 586 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070322/118b=
2255/PathPart.bin
More information about the Catalyst
mailing list