Re: CGI.pm v2.91 bug with $q->p()?



On 10/12/2006 04:12 AM, evillen@xxxxxxxxx wrote:
I am getting a warning for reasons that I can't understand and I
hesitantly believe may be a bug with CGI.pm v2.91

Synopsis - in certain circumstances if I use the CGI.pm paragraph
method $q->p() my program will work correctly but I get a version of
the following warning in my webserver error.log:

filename.cgi: Use of uninitialized value in join or string at (eval 19)

line 15.

If I simply substitute $q->p() with "<br>" I get no warnings. The very
simple CGI code below demonstrates the problem, simply comment out
either of the final two "print" commands to see the behaviour.

It is possible that this behaviour relates to a problem with CGI.pm
v2.91 described here http://tinyurl.com/npta8 although I may be wrong
;-)

Thanks for any help
NJH

Test code - run directly from browser as filename.cgi
----------------

#!c:/perl/bin/perl.exe -w

use strict;
use diagnostics;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $q = new CGI;

#-------------------------------------------------
# Print the html header

print $q->header;
print <<END_HTML;

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>

<form method="post" enctype="multipart/form-data"
action="dev_test.cgi">
Type something here: <INPUT TYPE=text NAME=foo SIZE=50
MAXLENGTH=50><INPUT TYPE=submit VALUE="Submit"></P>
</form>
END_HTML

#-------------------------------------------------
#The "print" command below works fine using "<br>"
#print "You typed: ", $q->param("foo"), "<br>";

#The "print" command below creates the following warning using $q->p()
#"Use of uninitialized value in join or string at (eval 19) line 15."
print "You typed: ", $q->param("foo"), $q->p();


I cannot reproduce this behavior with Perl 5.8.4 and CGI.pm $VERSION 3.04 .

Here, calling p() with no parameters produces an empty paragraph tag:

use CGI;
my $q = new CGI;
print $q->p('Want to see an empty paragraph?'), "\n";
print $q->p(), "\n";

OUTPUT:
<p>Want to see an empty paragraph?</p>
<p />


--
Mumia W.
paduille.4059.mumia.w@xxxxxxxxxxxxx
This is a temporary e-mail to help me catch some s-p*á/m.
.



Relevant Pages

  • Re: CGI.pm v2.91 bug with $q->p()?
    ... Synopsis - in certain circumstances if I use the CGI.pm paragraph ... simple CGI code below demonstrates the problem, ... # Print the html header ...
    (comp.lang.perl.misc)
  • SOLVED re: GD::Text::Wrap
    ... notes to clarify since I found the module notes to be scant. ... my $query = new CGI; ... EOSTR ... # left and top positioning of paragraph ...
    (perl.beginners)
  • CGI.pm v2.91 bug with $q->p()?
    ... I am getting a warning for reasons that I can't understand and I ... simple CGI code below demonstrates the problem, ... # Print the html header ...
    (comp.lang.perl.misc)
  • Re: Its not PHP, is it? (potential new CPAN module)
    ... I seem to have flamed the crap out of my boss in paragraph 3. ... CGI uses some odd conventions that I find too limiting. ... Is there an existing root-level namespace I should use for this? ... I've heard grumblings about all-caps module names. ...
    (comp.lang.perl.modules)
  • Re: Carriage Return and LineFeeds Question
    ... This cgi parses through the file, puts it in an array and if it encounters a paragraph break, I want it to insert "^P". ... It's just a consecutive sequence of newlines. ... print UPLOADFILE;} close UPLOADFILE; ...
    (perl.beginners)