thor has asked for the wisdom of the Perl Monks concerning the following question:
So, I've never written a CGI before, and I'm trying to get my feet wet, so to speak. In playing around with CGI, I've discovered something that I find a bit wierd. First the code:
Pretty standard, eh? Well, when I run this, I get the following output:#!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header(); print start_html("This is a test"); print start_form(); print end_form();
Notice the "uninitialized value" warning. From what I've been able to ascertain, the trouble starts with the start_form sub. I looked at the documentation for CGI, and it seems like it is reasonable to call start_form sans arguments. Also, I looked at CGI.pm's source, specifically at the startform sub. I'm able to clear the warning if I provide a query string, or if I provide an action to the subroutine. Perhaps I'm making too much out of it, but I would like this to run clean under warnings. Any insight would be appreciated. </form>Content-Type: text/html; charset=ISO-8859-1 <?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" lang="en-US" xml:lang="en-U +S"><head><title>This is a test</title> </head><body> Use of uninitialized value in length at (eval 9) line 11. <form method="post" action="/test.pl" enctype="application/x-www-form- +urlencoded">
thanks in advance,
thor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI "uninitialized value" question
by Roger (Parson) on Dec 09, 2003 at 05:15 UTC | |
by thor (Priest) on Dec 09, 2003 at 05:23 UTC | |
by Roger (Parson) on Dec 09, 2003 at 05:27 UTC | |
by rdfield (Priest) on Dec 09, 2003 at 09:42 UTC | |
|
Re: CGI "uninitialized value" question
by Anonymous Monk on Dec 09, 2003 at 13:13 UTC | |
|
Re: CGI "uninitialized value" question
by pg (Canon) on Dec 09, 2003 at 05:15 UTC | |
|
Re: CGI "uninitialized value" question
by Anonymous Monk on May 08, 2004 at 09:59 UTC |