[Catalyst] go to chained action

J. Shirley jshirley at gmail.com
Thu Dec 17 15:58:02 GMT 2009


2009/12/17 Alex Povolotsky <tarkhil at over.ru>:
> 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 ] )
>>
> Sorry, this does not work QUITE as expected.
>
> I'm forwarding() right now, and
> $c->forward($c->controller('MyController')->action_for('action_name'),[],[qw/argument/])
> does not pass ALL chain. What's strange, I do see mention of chain base in
> log, but chain base never get called.
>
> I could first forward to chain base manually, but that's not the thing I'm
> looking to.
>
> Alex.
>
>

Well, you are confusing two different things.

First you mention $c->go, which does what you want (internal complete
dispatch) but you had the incorrect syntax.

Then you say $c->forward, which simply forwards to an action and not
any intermediary points.

If you want to dispatch to the entire chain, use $c->go with the
correct syntax and you should be good.

-J



More information about the Catalyst mailing list