[Catalyst] access to query string?

Matthew Lawrence matthew.lawrence at ehsbrann.com
Fri Sep 30 13:13:39 CEST 2005


Keith Grennan wrote:
> Hey,
> 
> First off: Catalyst is great!  Thanks for all your work.
> 
> Quick question:
> 
> Is there a way to access the request query string from $c->req?
> 

There is a way of accessing this, but it is engine-dependent.

under apache: $c->apache->args()

under cgi: $c->cgi->query_string()

It seems to me that this is bad practise unless there really is no other 
way of achieving what you want, for example making a new query string 
from the params, like this:

use CGI ();

$query = CGI->new($c->req->params)->query_string;

It may not be the exact string, but it should be 100% functionally 
equivalent.

Hope this helps :-)

Matt


-- 

Matthew Lawrence
Senior Programmer
EHS Brann

http://www.ehsbrann.com/




More information about the Catalyst mailing list