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

Carl Johnstone catalyst at fadetoblack.me.uk
Tue Jun 10 15:33:50 BST 2008


> * 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)
>
> 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:

They're a little verbose. Essentially though they're just a different way of 
passing a listref/hashref into the method.

I'd certainly say you want these:

$c->action_uri($action_obj, \@captures, \@args, \%query) # Wot Matt said

$c->action_uri($action, undef, undef, undef); #use same caps/args/query as 
current
$c->action_uri($action); #ditto

$c->action_uri($action, [], [], {});  # blank caps/args/query

As far as an interface to allow add/amend/remove. It would be fairly easy 
for hashes as setting a key/value would either amend or create the pair, and 
setting undef as a value could be the trigger to delete a pair. That would 
work fine for the query, however I think trying to design an interface to do 
something similar for the two lists would be uglier than just directly 
altering the list itself.

Carl




More information about the Catalyst-dev mailing list