For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > October 2006 > CGI.pm v2.91 bug with $q->p()?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CGI.pm v2.91 bug with $q->p()?
evillen@gmail.com

2006-10-12, 6:55 pm

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();

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com