Aristotle Pagaltzis wrote:
* Chisel Wright <[EMAIL PROTECTED]> [2008-04-16 11:50]:Just for chuckles - does anyone have an idea of the pain-level involved in converting a non-Chained application to Chained?Or is it just not worth the effort for an established project?Totally depends. I ported an app to Catalyst that previously was basically one-action-per-controller. It cannot be called anything less than a lot of work, but it paid of royally. The code is as DRY as it was before, but it’s now far better structured. Previously it was blocks of if-elsif chains grouping together execution steps that are shared by some URIs but not others – now it’s Chained. A typical controller looks something like this: sub base : Chained PathPart('doc') CaptureArgs(0) { ... } sub list : Chained('base') PathPart('') Args(0) { ... } sub item : Chained('base') PathPart('') CaptureArgs(1) { ... } sub view : Chained('item') PathPart('') Args(0) { ... } sub edit : Chained('item') Args(0) { ... }
Just a sidebar to this. Chained PathPart('') is your friend.
It is NOT the friend of index : Private or default : Private
If you make use of Chained, don't use index/default. They don't act
properly when doing things like:
->config( path => 'foobar' ) to put controllers into a different uri. -=Chris
signature.asc
Description: OpenPGP digital signature
_______________________________________________ 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/
