[Catalyst-dev] Developing action_uri() for Catalyst 5.80

Matt S Trout dbix-class at trout.me.uk
Sun Jun 8 18:34:29 BST 2008


On Fri, Jun 06, 2008 at 04:21:01PM -0400, Jason Gottshall wrote:
> I'd like to establish consensus on the calling signature (and method
> name) for action_uri(). Based on the code I've seen from others (and my
> own bias), here's one option:
> 
>   $c->action_uri('/private/path/to/action', \@captures_if_any,
> \%query_params);

$c->action_uri($action_obj, \@captures, \@args, \%query)

$c->action_uri([ $controller_name, $action_name ], \@captures, \@args, \%query)
  (calls $c->controller($controller_name)->action_for($action_name) to get obj)

$c->action_uri($action_name, @captures, \@args, \%query)
  (calls $c->controller->action_for($action_name) to get obj)

Note that this implementation would allow us to extend $action_name to allow
either a /foo/bar, foo:bar, foo.bar or Foo->bar syntax later, but we don't
have to provide one in the first cut, which gets round most of the worrying.

Notice that there's no real DWIMing on signatures here beyond the initial
part - the arg list is -always- four elements (though presumably later
ones can be left off).

The thing that I wonder about though is: Do we not want to provide some
mechanism to say "the same captures as the current request -plus- this one"
or "-less- this one" or "-except- with this different last one" or similar?
(and same for args)

-- 
      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-dev mailing list