[Catalyst] Dynamic Argument count

Tomas Doran bobtfish at bobtfish.net
Tue Jan 12 12:43:02 GMT 2010


Christoph Friedrich wrote:
 > And in the end sub I want to check if there is a Ajax Parameter and then
 > send the stash to the JSON View instead of the TT View.

Try this:

sub base : Chained('/') PathPart('/guild') CaptureArgs(2) {}
sub list_guilds : Chained('base') PathPart('') CaptureArgs(0) {}
sub list_guilds_end : Chained('list_guilds') PathPart('') Args(0) {}
sub list_guilds_end_json : Chained('list_guilds') PathPart('json') Args(0) {
     my ($self, $c) = @_;
     $c->stash->{current_view} = 'JSON';
}

Cheers
t0m



More information about the Catalyst mailing list