Subject: | HTML::Form produces warnings when parsing form with select tags w/o name attribute |
When calling HTML::Form->parse on a form with "select" tags which do not
have a "name" attribute, HTML::Form produces a large number or warnings
as follows:
Use of uninitialized value in hash element at
/usr/lib/perl5/site_perl/5.8.8/HTML/Form.pm line 209
Use of uninitialized value in hash element at
/usr/lib/perl5/site_perl/5.8.8/HTML/Form.pm line 229.
Use of uninitialized value in hash element at
/usr/lib/perl5/site_perl/5.8.8/HTML/Form.pm line 229.
... etc ...
Use of uninitialized value in hash element at
/usr/lib/perl5/site_perl/5.8.8/HTML/Form.pm line 229.
example HTML which causes warning:
<select id="myselect">
<option>one</option>
<option>two</option>
<option>three</option>
</select>
I have attached a small fix, and should fix said issue in WWW::Mechanize
as well (which is what is causing this repeated warning in my particular
application), which calls this in it's internal update_html function.
I am using HTML::Form v5.817, Perl v5.8.8 built for i386-linux-thread-multi
Subject: | Form.patch |
--- Form.pm 2009-01-21 23:39:50.000000000 -0500
+++ Form.pm 2009-01-21 23:40:21.000000000 -0500
@@ -205,6 +205,7 @@
$attr->{"select_$_"} = delete $attr->{$_}
if exists $attr->{$_};
}
+ $attr->{name} = '' unless defined $attr->{name};
# count this new select option separately
$openselect{$attr->{name}}++;