[Catalyst] go to chained action
Alex Povolotsky
tarkhil at over.ru
Thu Dec 17 12:34:21 GMT 2009
Tomas Doran wrote:
>
> 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.
>
Okay, thanks, it works!
Alex.
More information about the Catalyst
mailing list