There is a $NO_UNDEF_PARAMS var in new versions of CGI.pm (in 2.78, not in 2.74) but the default is 0 so this is not the problem. I presume you understand the difference between exists and defined with respect to hashes. Your results are not repeatable vis:

use strict; use CGI; use Data::Dumper; my %fields; my $q = new CGI ( 'name=&value=&void=' ); print "got param '$_'\n" for $q->param; $fields{$_} = $q->param($_) for $q->param; print Dumper($q, \%fields); __END__ got param 'name' got param 'value' got param 'void' $VAR1 = bless( { 'void' => [ '' ], '.charset' => 'ISO-8859-1', '.parameters' => [ 'name', 'value', 'void' ], '.fieldnames' => {}, 'value' => [ '' ], 'name' => [ '' ] }, 'CGI' ); $VAR2 = { 'void' => '', 'value' => '', 'name' => '' };

The .fieldnames should actually contain the fieldnames (this is really a bug) but the ultimate behaviour is not broken. I presume you have an old version of CGI.pm which does not have the .parameters part in the object and works off .fieldnames which was the behaviour pre 2.63? I think. Which version do you have?

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: CGI.pm and blank form fields by tachyon
in thread CGI.pm and blank form fields by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.