[Catalyst] uri_for() and Chained endpoints: a proposed convenience method

Matt S Trout dbix-class at trout.me.uk
Fri Jan 26 20:51:46 GMT 2007


On 26 Jan 2007, at 20:41, Jason Gottshall wrote:

> In using chained dispatch, I found that getting URIs for specific
> endpoints felt a bit clumsy:
>
> I wanted a way to condense the fairly wordy call to
> $c->controller()->action_for(), so I added the following convenience
> method to MyApp.pm:
>
>   sub uri_for_endpoint {
>     my ( $c, $endpoint, @args ) = @_;
>     my ( $controller, $action ) = ( split m[/], $endpoint, 2 )[ -2, -1
> ];
>     return $c->uri_for(
>       $c->controller($controller)->action_for($action),
> 	@args
>     );
>   }

I think the last long discussion on the -dev list about this  
(archives are public and googlable :) resulted in us calling it  
uri_to and not trying to make it Chained-specific, and wanting to  
make it more intelligent than yours.

Maybe you could subscribe to -dev and once we finally thrash out what  
we want to do with this you could help with implementation/test-cases/ 
whatever?

But yeah, it -is- a sensible idea and we already want something in  
the dist and we'd love you to help out with getting it in there :D

-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +





More information about the Catalyst mailing list