Re: Is there a better way to reset CGI object for AJAX POSTDATA?



On Dec 21, 3:10 pm, Dodger <el.dodg...@xxxxxxxxx> wrote:
Currently I'm doing this:

use CGI();
my $cgi = new CGI;
$cgi = new CGI($cgi->param('POSTDATA'));

... in order to get the data an XMLHTTPRequest object sends through on
a POST request, because everything goes under the POSTDATA param as a
query string. AND can I just say... Yuck!

Anyway, my solution seems kludgy and I don't like it. It smells funny.

CGI.pm docs mention a class method restore_parameters() that works
like so:
open (IN,"test.in") || die;
restore_parameters(IN);
close IN;
...but there's no other mention of it, and no mention of an object
method. I can't stand using the functional interface for CGI.pm.

Isn't there any way to just reset an existing CGI object directly
without calling the constructor all over again?

--
Sean 'Dodger' Cannon

Actually, even that's not working right. Dammit.
According to the docs, I can create a new CGI object with a properly
formatted query string as an argument and *those* params are supposed
to be what it parses.

Quoth the docs:
"or from a properly formatted, URL-escaped query string:

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

But if I try this, and even if I am VERY careful to make sure it's in
scalar context:

use CGI();
my $cjax = new CGI;
my $POSTDATA = $cjax->param('POSTDATA');
undef $cjax;

my $cgi = new CGI($POSTDATA);

I still get back:
print join ', ', $cgi->param();
prints:
POSTDATA

So WTF??
.



Relevant Pages

  • Re: Is there a better way to reset CGI object for AJAX POSTDATA?
    ... my $cgi = new CGI; ... because everything goes under the POSTDATA param as a ... formatted query string as an argument and *those* params are supposed ... POSTDATA taken as a param does contain a properly ...
    (comp.lang.perl.modules)
  • Re: Is there a better way to reset CGI object for AJAX POSTDATA?
    ... my $cgi = new CGI; ... formatted query string as an argument and *those* params are supposed ... POSTDATA taken as a param does contain a properly ...
    (comp.lang.perl.modules)
  • Re: Perl CGI and Javascript
    ... I have a page where there's a dropdown. ... it opens up a page (calling a CGI here). ... can't you write a javascript function that submits the form and then ... When I call the CGI and pass content as query string, ...
    (comp.lang.perl.misc)
  • Re: QUERY_STRING
    ... > The query_string is really a product of the client. ... The query string is a part of the CGI hand-shake between systems. ... You can have a Query String between any systems which agree to CGI. ...
    (perl.beginners)