[Catalyst-dev] RFC: $c->uri_for_chained
    Ash Berlin 
    ash at cpan.org
       
    Tue Oct 17 14:01:29 CEST 2006
    
    
  
Ash Berlin wrote:
> Right then,
>
> Finally got annoyed with having to do the likes of (in TT):
>
> c.uri_for(c.controller('Private').action_for('path'), 
> c.req.captures.merge([test.id]), 'some', 'more', 'params')
>
> cos you know - thats EVIL.
>
> I propose a solution something like the following:
>
> $c->uri_for_chained('/private/path', @{$c->req->captures}, $test->id, 
> qw/some more params')
>   
 From Matt's comments in IRC i might not have been clear enough here:
The point of this is to make URIs for chained actions easier.
Take for example:
/script/foo/rename/newname
Actions for that are:
/script/*/rename/* => /script/script (1) => /script/rename (1)
This then finds out that the script "newname" already exists so provides 
a link to delete that script or to replace the contents with the current:
/script/newname/delete => /script/script (1) => /script/delete (0)
/script/newname/copy_from => /script/script (1) => /script/copy_from (1)
Basically my complaint with uri_for as it stands is that it relies upon 
me knowing the dispatch chain and how many args each chained action 
takes. Yes, I "know" this info, but I shouldn't have to look it 
up/remember it when the dispatcher itself quite happily returns undef 
when I get it wrong...
Any clearer?
    
    
More information about the Catalyst-dev
mailing list