[Catalyst] redirect() with parameters

Matt S Trout dbix-class at trout.me.uk
Mon Apr 24 19:29:06 CEST 2006


Will Hawes wrote:
> Not sure if this has been discussed before, but I think it would be 
> convenient if $c->response->redirect() accepted a hashref of arguments 
> to append to the redirect URI.
> 
> For example, if I want to redirect to 
> "/action?param1=value1&param2=value2":
> 
> my $params = {
>    param1 => 'value1',
>    param2 => 'value2'
> };
> 
> ...
> 
> $c->response->redirect("/action", $status, $params );
> 
> Make sense?

No, because that's going to destroy your ability to deploy to anything other 
than /. Do it properly -

$c->response->redirect($c->uri_for("/action", $params), $status);

and the convenience is already there.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list