[Catalyst] go to chained action

Derek Wueppelmann dwueppel at gmail.com
Wed Dec 16 13:44:27 GMT 2009


On Wed, 2009-12-16 at 16:18 +0300, 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.

If you want an actual redirect you can do something like this:

$c->res->redirect($c->uri_for($c->controller('controller')->action_for('action'), [qw(argument)]));
$c->detach();

That will work it's way through the chain and should be seamless for the
end user when accessing the page.

-- 
 o)   Derek Wueppelmann           (o
(D .   dwueppel at gmail.com          D).
((`     http://www.monkeynet.ca   ( ) `





More information about the Catalyst mailing list