POST to URL with query string and CGI.pm

R

Richard Gration

I was just wondering how many people recognise these comments from
CGI.pm, and how many people have spent hours debugging to trace the cause
to not getting what they expect when their form actions have a query
string on the end ... ?

# Some people want to have their cake and eat it too!
# Uncomment this line to have the contents of the query string
# APPENDED to the POST data.

Grrr. ;-)

Is there a way to recover the decoded query string parameters (and
values) for a POST request from CGI.pm without tweaking the source in
this way? I suspect not ...

Rich
 
B

Brian McCauley

Richard Gration said:
I was just wondering how many people recognise these comments from
CGI.pm, and how many people have spent hours debugging to trace the cause
to not getting what they expect when their form actions have a query
string on the end ... ?

# Some people want to have their cake and eat it too!
# Uncomment this line to have the contents of the query string
# APPENDED to the POST data.

Grrr. ;-)

Is there a way to recover the decoded query string parameters (and
values) for a POST request from CGI.pm without tweaking the source in
this way? I suspect not ...

I suspect you are wrong. From perldoc CGI

It is possible for a script to receive CGI parameters in
the URL as well as in the fill-out form by creating a form
that POSTs to a URL containing a query string (a "?" mark
followed by arguments). The param() method will always
return the contents of the POSTed fill-out form, ignoring
the URL's query string. To retrieve URL parameters...

Finding this extract in "perldoc CGI" to discover how that sentence
ends is left as an exercise for the reader :)

--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
 
R

Richard Gration

Brian said:
I suspect you are wrong. From perldoc CGI

It is possible for a script to receive CGI parameters in
the URL as well as in the fill-out form by creating a form
that POSTs to a URL containing a query string (a "?" mark
followed by arguments). The param() method will always
return the contents of the POSTed fill-out form, ignoring
the URL's query string. To retrieve URL parameters...

Finding this extract in "perldoc CGI" to discover how that sentence
ends is left as an exercise for the reader :)

OK, I'm a small mammal from Greenland. <blushes>

Thanks for the pointer :) I did read the CGI docs but didn't see that. I
certainly won't forget it after this afternoon's debugging exploits.
Funniest thing is that the source tweak is much easier to find than the
relevant comment in the docs, 'cos it's only a few hundred lines from the
top of CGI.pm as opposed to a few thousand lines into the docs! I suspect
I'll have a problem when I upgrade the module, and I suspect I'll be right
about that suspicion ;-)

Cheers
Rich
 

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
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top