I'm trying to create a hash of form fields and values using HTML::Form. Note from the code below that I'm using the LWP content method to fetch the form.
The relevant code is:
use HTML::Form;
my $form = HTML::Form->parse($response->content, $targetURL);
map $fields{$_} = $form->value($_), $form->inputs;
When I run this code I get the error message:
No such field 'HTML::Form::TextInput=HASH(0xa02cd30)'
When I supply a list of field names in place of $form->inputs everything works as expected.
When I try dereferencing $form->inputs I get the error message:
Can't use string ("31") as a HASH ref while "strict refs" in use or Can't use string ("31") as an ARRAY ref while "strict refs" in use (depending on whether I dereference $form->inputs as a hash or as an array).
The Perl HTML::Form documentation describes the inputs method as follows:
$form->inputs
This method returns the list of inputs in the form.
Any idea what the problem is?
I've got a work around using HTML::TokeParser but I'd rather learn why I can't get the inputs method to return a list I can use in my code.
Thanks! Mutant solved my problem. Another step along the path of figuring out object oriented programming!
-- Chris