Hi all, Just wondering - is it possible for an action to have multiple chain paths?
I'd like my site to have a path like /user/N/profile (/user/N being a chain path, /profile being an end node off that path), but also have a path like /my/profile (where /my is a chain path that acts as if the user put their own ID on the end of /user/N). Currently I have /user/N as a chain path, /my as a chain path, and then a profile action (path: /profile) that chains off of /user/N and a this_profile action (path: /profile) that chains off of /my that simply calls the profile action like so: # in the User controller sub user :Chained('/') :PathPart('user') :CaptureArgs(0) { # This is only here so a (not shown) chain makes '/user' a valid path } sub specific_user :Chained('user') :PathPart('') :CaptureArgs(1) { # Captured arg goes in $c->stash->{userid} } sub this_user :Chained('/') :PathPart('my') :CaptureArgs(0) { # The current user's ID goes in $c->stash->{userid} } sub profile :Chained('specific_user') :PathPath('profile') :Args(0) { # Do stuff using $c->stash->{userid} } sub this_profile :Chained('this_user') :PathPart('profile') :Args(0) { # Dummy - redirect to the main 'profile' action shift->profile(@_); } This works, but is it the best way to do it? TIA, MDB _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/