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 ;-)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |