On 16 Jul 2009, at 16:30, Derek Wueppelmann wrote:

sub json : Chained('/') ChainedArgs(0) {
        my ($self, $c) = @_;

Is this something that is possible? Should I even be using Chaining for
this? Any help would be appreciated.

Call your top level path part root, then inherit (or apply as a role) the rest of the chain parts.

e.g.

package MyApp::Stuff;
use Moose::Role -traits => 'MethodAttributes';

sub thingie : Chained('root') PathPart('thingie') Args(0) {}


package MyApp::Controller::Root;
with 'MyApp::Stuff';
sub root : Chained('/') PathPart('') CaptureArgs(0) {}

package MyApp::Controller::JSON;
with 'MyApp::Stuff';
sub root : Chained('/') PathPart('json') CaptureArgs(0) {}

Will give you:

/thingie
and
/json/thingie

Cheers
t0m


_______________________________________________
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/

Reply via email to