[Catalyst] go to chained action

Tomas Doran bobtfish at bobtfish.net
Wed Dec 16 20:39:09 GMT 2009


On 16 Dec 2009, at 13:18, Alex Povolotsky wrote:

> Hello!
>
> Having, for example, /controller/*/action handled by /controller/ 
> base (1) => /controller/action, how do I write correct go to / 
> controller/argument/action ?
>
> just $c->go('/controller/argument/action') does not work. $c->go('/ 
> controller/action', [qw(argument)]) does not work as well, while $c- 
> >detach('/controller/action', [qw(argument)]) seems to be working.
>
> Actually, I'm looking for some kind of internal redirect.

Try $c->go($c->controller('MyController')->action_for('action_name'),  
[], [qw/ argument /]);

The go method is documented as:

$c->go( $action [, \@captures, \@arguments ] )
$c->go( $class, $method, [, \@captures, \@arguments ] )

So what you're trying is documented as not working :)

You _may_ get away with
Try $c->go($c->controller('MyController')->action_for('action_name'),   
[qw/ argument /]);

(i.e. omitting the captures if you only want args), but I'm unsure  
about that.

Cheers
t0m




More information about the Catalyst mailing list