On Tue, 15 Feb 2011, will trillich wrote:
Does this seem like a "best practice"? Comments welcome.
Personally, my take on best practices for chaining is basically "make sane
RESTful URIs".
I like to name my non-public chain point with private subs, and I like
my end points to be descriptive. So given that, I'd probably do
something like:
package MyApp::Controller::Xyzzy;
sub _set_xyzzy : Chained PathPart('xyzzy') CaptureArgs(0) { }
sub list : Chained('_set_xyzzy') PathPart('') Args(0) { }
# CSV dispatch based on Accept header, not URI!
sub _set_item : Chained('_set_xyzzy') PathPart('') CaptureArgs(1) { }
sub item : Chained('item') PathPart('') Args(0) { }
Although nowadays I've started using CX::Routes, which lets me _not_
name the subs themselves. I actually like this, since the subroutine
names don't participate in routing when you use chaining.
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/
_______________________________________________
List: [email protected]
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/