Question regarding CGI.pm 
Author Message
 Question regarding CGI.pm

I'm trying to debug a script I wrote (with the help of CGI.pm) which
generates a web page with a form.  Up to know, Ive always been able to
pop in the following code to find out what params are being passed after
the submit button is pressed (per the CGI.pm man page):

$query=new CGI;
print "<H2>Current Values</H2> $query\n<P>";

but instead of a list of the parameters (which is the normal response),
i get this:

Current Values

CGI=HASH(0x140145c78)

I've tried this is several parts of the script now, with the same
response (except the numbers after HASH are different).   The only
things that's changed is we upgraded from Perl 5.003_2 to Perl 5.005.
After we found the above code doesn't work, we upgraded CGI.pm from 2.3
to 2.43 (the newest version we could find).  This hasn't fixed the
problem.

I've copied the script I'm debugging to one of our servers that's still
running Perl 5.003_2, and the piece of code above works jsut fine, so I
think the problem is coming from the fact that we're running Perl
5.005.  Any ideas or workarounds?  Any idea of anything else with CGI.pm
that breaks with Perl 5.005?

Greg Coit



Fri, 20 Apr 2001 03:00:00 GMT  
 Question regarding CGI.pm

Quote:

> I'm trying to debug a script I wrote (with the help of CGI.pm) which
> generates a web page with a form.  Up to know, Ive always been able to
> pop in the following code to find out what params are being passed after
> the submit button is pressed (per the CGI.pm man page):

> $query=new CGI;
> print "<H2>Current Values</H2> $query\n<P>";

> but instead of a list of the parameters (which is the normal response),
> i get this:

> Current Values

> CGI=HASH(0x140145c78)

I find it difficult to believe that that ever worked.
But even if it did, it's really not the best way to do
what you're trying to do.  Instead, print $query->dump.

--
John "Throbblefoot" Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

"The people at the Grey Hotel
  Are either aged or unwell." -- EG



Fri, 20 Apr 2001 03:00:00 GMT  
 Question regarding CGI.pm

Quote:

> I find it difficult to believe that that ever worked.
> But even if it did, it's really not the best way to do
> what you're trying to do.  Instead, print $query->dump.

I appreciate the reply.  I've tried this on both verions of Perl, and I get
"can't call method "dump" on an undefined value".  Defining the variable
$query didn't help, it just produced a blank page.

Greg



Fri, 20 Apr 2001 03:00:00 GMT  
 Question regarding CGI.pm

said:

Greg> know, Ive always been able to pop in the following
Greg> code to find out what params are being passed after

I really can't believe that would ever have worked...unless
a much earlier CGI.pm had overloading for the object in a
string context...

Greg> $query=new CGI; print "<H2>Current Values</H2>
Greg> $query\n<P>";

Would be better to use the HTML shortcuts here:

    use CGI qw(:all);

    print header(...), start_html(...);

    print h1(...);

    print h2('Current Values'), CGI::dump(), p;

    print ...;

    print end_html;

Greg> CGI=HASH(0x140145c78)

This is because `$query' is the object (hash) reference.

hth
tony
--
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:



Sat, 21 Apr 2001 03:00:00 GMT  
 Question regarding CGI.pm
I appreciate all the responses to my question.  This short snippet:

$query=new CGI;
print "<H2>Current Values</H2> $query\n<P>";

*did* work with 5.003_2 (I got it straight from the CGI.pm man page - oh,
and yes is did require start_html and end_html stuff too), but Lincoln Stein
indicated in his email reply that this was broken in Perl 5.004, so it's
been removed.  I also tried $query->dump with no success, it gave me "can't
call method "dump" on an undefined value".  A friend of mine sent me his
version of dumping params, and it works just fine (I'd include it here, but
I haven't had a chance to ask his permission to share his code).  But I do
appreciate the help from everybody who responded, and especially to Lincoln
for writting CGI.pm

Greg Coit



Sat, 21 Apr 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Question regarding CGI.pm, nt_upload.lib and parsing.

2. Question regarding CGI.pm

3. CGI.PM - Question regarding carriage return and newline

4. Regards CGI.pm

5. Question regarding installing CPAN.pm

6. CGI Question In Regards To & Char

7. Carp.pm and CGI::Carp.pm versioning questions

8. Carp.pm and CGI::Carp.pm versioning questions

9. novice question re CGI.pm/cgi-lib.pl

10. CGI.pm,, LWP.pm or HTML.pm

11. regarding cgi mail...

 

 
Powered by phpBB® Forum Software