Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: CGI - How to use upload_hook and query the query string ?

by ikegami (Pope)
on Feb 07, 2006 at 18:22 UTC ( #528586=note: print w/ replies, xml ) Need Help??


in reply to CGI - How to use upload_hook and query the query string ?

The hook needs to be called when the request is being parsed (i.e. in new), and the request needs to be parsed in order to know what parameters were supplied. .

Fortunately, the QUERY_STRING is parsed before the body is parsed, so you can use param to check parameters from the QUERY_STRING inside of your hook. Unforunately, the CGI request is not passed to the hook, so you'll have to store the CGI request in a "global":

my $cgi; sub hook { return if not $cgi->param(...); my (...) = @_; ... } $cgi = CGI->new(\&hook);


Comment on Re: CGI - How to use upload_hook and query the query string ?
Select or Download Code
Re^2: CGI - How to use upload_hook and query the query string ?
by cees (Curate) on Feb 07, 2006 at 21:56 UTC

    I thought that by default CGI.pm did not parse the QUERY_STRING if it was a POST request... You actually have to edit the code to get it to parse and combine both the GET and POST parameters together.

    Search the source for CGI.pm for the string "Some people want to have their cake and eat it too".

      Your right. I looked at the source, but I looked too quickly and mistook something else for the parsing of QUERY_STRING. They'll have to modify their CGI.pm or use my alternate solution.
        I've gone down the route of putting the parameters in the URL action of the form as simple query paramaters which seems to work just fine. Many thanks for all the suggestions.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://528586]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-09-02 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (25 votes), past polls