[Catalyst] how to get controller path

Matt S Trout dbix-class at trout.me.uk
Tue Nov 20 12:52:54 GMT 2007


On Tue, Nov 20, 2007 at 12:27:32PM +0530, Alok Sharma wrote:
> Hi,
> Need a bit of help.
> Given a path we have ways to get the uri using the method uri_for(path).
> Is there a  possible way to get the controller path given the uri so I am able 
> to do some thing like this
> 	$c->res->redirect(uri); $c->forward(controller_path(uri));

Why can't you start off with a controller action?

my $action = $c->controller('Foo')->action_for('bar'); # Controller::Foo->bar

$c->res->redirect($c->uri_for($action));
$c->forward($action->reverse);

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list