parsing query strings

S

sreservoir

yes, it would generally be better to just let CGI do it; but is there a
way to let CGI parse arbitrary strings and stuff them into the param()
hash, or will I have to write a wrapper?
 
S

sreservoir

Ben said:
You need to explain a bit more about what you are trying to do. Are you
trying to parse a query-string from somewhere other than the CGI
environment? If so you may be find the URI and URI::QueryParam modules
helpful.

say you have a string "a=b&b=a" and a cgi object $q.

parse the string to let $q->param("a") eq 'b' && $q->param("b") eq 'a'.

er, the opposite of URI::QueryParam.
 
J

John Bokma

sreservoir said:
say you have a string "a=b&b=a" and a cgi object $q.

parse the string to let $q->param("a") eq 'b' && $q->param("b") eq 'a'.

er, the opposite of URI::QueryParam.

The hash method in URI::Query and use $cgi->param() to set the values?
(I never like the use of $q)
 
X

Xho Jingleheimerschmidt

sreservoir said:
say you have a string "a=b&b=a" and a cgi object $q.

You already have a cgi object $q? Then what you are planning on doing
with it's old contents?
parse the string to let $q->param("a") eq 'b' && $q->param("b") eq 'a'.

er, the opposite of URI::QueryParam.

From CGI docs:

You can also initialize the query object from
.....
or from a properly formatted, URL-escaped query string:

$query = new CGI('dinosaur=barney&color=purple');



Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,215
Messages
2,571,113
Members
47,711
Latest member
RosalindKe

Latest Threads

Top