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

Matt S Trout dbix-class at trout.me.uk
Wed Jun 11 20:55:52 BST 2008


On Mon, Jun 09, 2008 at 02:14:00PM -0400, Jason Gottshall wrote:
> 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));

or you could just

use Moose::Autobox;

$c->req->captures->splice(...)

:)

-- 
      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