[Catalyst] How much chain?

Peter Flanigan pjf at roxsoft.co.uk
Fri Jul 11 14:02:21 BST 2008


Lots of chain. I use something like this:

package MyApp::Controller::Admin;

sub lang : Chained('/') PathPart('') CaptureArgs(1) {
    # Capture the language selection from the requested uri
}

sub base : Chained('lang') PathPart('admin') CaptureArgs(0) {
    # Does nothing but lets me chain other things on /en/admin
    # that do not need any common initialisation
}

sub users : Chained('base') PathPrefix CaptureArgs(0) {
    # Stashes things common to all endpoints chained on /en/admin/users
}

sub view_form : Chained('users') PathPart('') Args {
    # Endpoint with optional argument
}

which gives (I think since this was hacked down from what I really have)

/en/admin/users/123

-- 

Regards



More information about the Catalyst mailing list