Subject: | MIXING POST AND URL PARAMETERS doc section is somewhat misleading |
Date: | Mon, 23 Feb 2009 16:58:55 -0900 |
To: | bug-CGI.pm [...] rt.cpan.org |
From: | "Britton Kerin" <bkerin [...] fastmail.fm> |
This section looks like this:
$color = url_param('color');
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, call the url_param() method. Use it in the same way as
param(). The main difference is that it allows you to read the
parameters, but not set them.
Under no circumstances will the contents of the URL query string
interfere with similarly-named CGI parameters in POSTed forms. If
you try to mix a URL query string with a form submitted with the GET
method, the results will not be what you expect.
What seems to happen for me is that when I load a url (hit return in the
URL
field in the browser) with a ?foo=bar addition, then param() gives me
the
param foo with value bar, at least according to CGI::Dump(). But if I
then
type in a form value and push a button that causes a submit, the url
value
parameter isn't in the list but the other form values are. I'm using
the
function interface rather than the $q->param() sort, not sure if that
makes
a difference. If not, it seems a bit strong to say that param() always
returns the POSTed values, since it doesn't seem to do that when there
aren't any POST values but there are url parameters.
Britton