@Devendra I think your examples can be somehow deceiving if someone reads them.
uri_for expects a path (not an action). It returns an absolute URI object, therefore, for example, it is useful for binding to static content or in case you do not expect your paths to change.
So, let's say you deployed your application on the domain example.com and subdir abc (example.com/abc/): $c->uri_for('/static/images/catalyst.png') returned example.com/abc/static /images/catalyst.pn, or for example: $c->uri_for('/contact-us-today') will return example.com/abc/contact-us-today. If later you decide to deploy your application in another subdirectory or in / you will still get the correct links.
Let's say your contact-us action looks like this: sub contact :Path('/contact-us-today') :Args(0) {...} , and you later decide that / contact -us-today should become simple / contact -us. If you used uri_for('/contact-us-today') , you need to find and change all the lines pointing to this URL. However, you can use $c->uri_for_action('/controller/action_name') , which will return the correct URL.
source share