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

Jason Gottshall jgottshall at capwiz.com
Mon Jun 9 19:14:00 BST 2008


On Monday, June 09, 2008 11:17 AM, Matt S Trout <dbix-class at trout.me.uk>
wrote:

> On Sun, Jun 08, 2008 at 09:17:59PM +0200, Aristotle Pagaltzis wrote:
>> * Matt S Trout <dbix-class at trout.me.uk> [2008-06-08 19:35]:
>>> 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)
>> 
>> For query params all you need to do is load URI::QueryParam, then
>> the URI object you get back has methods like `query_param_delete`
>> and `query_param_append`. I rely on that quite extensively for
>> some parts of my app.
> 
> But I'm talking about captures and args, neither of which is
> a query param.

But why not a similar mechanism for captures args? What if
$c->req->captures and $c->req->args returned objects that implemented
basic list manipulation? Then, using methods provided by List::oo as an
example, you could do things like:

  # one more capture, one less arg
  $c->action_uri($action, $c->req->captures->ipush(123),
$c->req->args->ipop);

  # swap out last capture (or arg)
  $c->action_uri($action, $c->req->captures->ipop->ipush(123));  
  # also written as:
  $c->action_uri($action, $c->req->captures->isplice(-1, 1, 123));

Jason



More information about the Catalyst-dev mailing list