What is the difference between $c->uri_for
and $c->uri_for_action
methods of Catalyst.
Which one to use? And why?
I found below difference between $c->uri_for
and $c->uri_for_action
Consider
__PACKAGE__->config(namespace => 'Hello');
.
.
.
sub bar: Local{
$c->res->redirect($c->uri_for('yourcontroller/method_name'));
$c->res->redirect($c->uri_for_action('yourcontroller/method_name'));
}
sub method_name: Local{
print "In Yourcontroller:: method_name"
}
In case of $c->uri_for
the url changes to
http://localhost:3000/Hello/yourcontroller/method_name
However for $c->uri_for_action
the url changes to
http://localhost:3000/yourcontroller/method_name
So the namespace gets added in case of uri_for
.