ecuguru has asked for the wisdom of the Perl Monks concerning the following question:
And I'm trying to find a way to be able to parse a get/post request into variables, as well as log the get/post request. Currently, I'm using a series of:use CGI qw/:standard/; use CGI::Validate;
And it works great for parsing the variables.my $variable = param( "var" ) || "OFF";
Works great for get requests, I can parse the variables and log the get request. But with Post requests, I can parse the variables, but the post request doesn't get logged (cause it's already been read in by the variables and there is nothing to readin in). When I move the get/post log function to the top of the param calls, Get still works, and the Post logger works, but I don't get to parse the variables if it's a post cause it's been read into $request.if ($ENV{'REQUEST_METHOD'} eq "GET") { $request = $ENV{'QUERY_STRING'}; } if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $request,$ENV{'CONTENT_LENGTH'}) || warn "Could not get query\n"; } ##Then Save $request to file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Log a Post Request
by brian_d_foy (Abbot) on Jan 23, 2006 at 19:32 UTC | |
by ikegami (Patriarch) on Jan 23, 2006 at 19:39 UTC | |
|
Re: Log a Post Request
by ikegami (Patriarch) on Jan 23, 2006 at 19:36 UTC |