In relation to my last post, a co-worker asked me how i might add a URL like /admin/account/create to the mix. here is what i came up with for a solution:
package MyApp::Controller::Admin::Account;
use strict;
use warnings;
use base 'Catalyst::Controller';
# methods on /admin/account/
sub root : Chained('/') PathPrefix CaptureArgs(0) { }
sub list : Chained('root') PathPart('') Args(0) { die "index of accounts" }
# methods on /admin/account/$name
sub create : Chained('root') PathPart Args(0) { die "create an account" }
# methods on /admin/account/$id/[$name]
sub instance : Chained('root') PathPart('') CaptureArgs(1) { }
sub view : Chained('instance') PathPart('') Args(0) { die "view account" }
sub update : Chained('instance') PathPart Args(0) { die "update account" }
1;
I've added in a root midpoint which will allow us to chain any other method off of /admin/account.
(Again, sanity checked by mst)