package HTML::Form;
use strict;
use URI;
use Carp ();
use vars qw($VERSION);
$VERSION='0.03';
my %form_tags = map {$_ => 1} qw(input textarea button select option);
my %type2class = (
text => "TextInput",
password => "TextInput",
file => "TextInput",
hidden => "TextInput",
textarea => "TextInput",
button => "IgnoreInput",
"reset" => "IgnoreInput",
radio => "ListInput",
checkbox => "ListInput",
option => "ListInput",
submit => "SubmitInput",
image => "ImageInput",
);
=head1 NAME
HTML::Form - Class that represents HTML forms
=head1 SYNOPSIS
use HTML::Form;
$form = HTML::Form->parse($html, $base_uri);
$form->value(query => "Perl");
use LWP;
LWP::UserAgent->new->request($form->click);
=head1 DESCRIPTION
Objects of the C class represents a single HTML instance. A form consist of a sequence of inputs that
usually have names, and which can take on various values.
The following methods are available:
=over 4
=item $form = HTML::Form->new($method, $action_uri, [[$enctype], $input,...])
The constructor takes a $method and a $uri as argument. The $enctype
and and initial inputs are optional. You will normally use
HTML::Form->parse() to create new HTML::Form objects.
=cut
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->{method} = uc(shift || "GET");
$self->{action} = shift || Carp::croak("No action defined");
$self->{enctype} = shift || "application/x-www-form-urlencoded";
$self->{inputs} = [@_];
$self;
}
=item @forms = HTML::Form->parse($html_document, $base_uri)
The parse() class method will parse an HTML document and build up
C objects for each