[Catalyst] uri_for() and Chained endpoints: a proposed convenience method

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Jan 26 20:56:54 GMT 2007


On 1/26/07, Jason Gottshall <jgottshall at capwiz.com> wrote:
> 1) Is my convenience method a sensible approach, or is there a "better"
> way to do this?

I usually stuff this inside MyApp.pm:

  sub uri_for_action {
      my ($c, $controller, $action, @params) = @_;
      $c->uri_for( $c->controller($controller)->action_for($action), @params );
  }

It works pretty nicely for me. Its only drawback is that if you're
doing some refactoring and decide to move some methods to a new
controller, you'd probably need to change whenever it was called. But
it's grepable and pretty reasonable IMO.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list