HTML::FormParser - Do things with the contents of HTML forms. |
HTML::FormParser - Do things with the contents of HTML forms.
use HTML::FormParser; $p = HTML::FormParser->new(); $p->parse($html, form => sub { ... }, input => sub { ... });
An object-oriented module inheriting from HTML::Parser. HTML::FormParser takes a string containing HTML text and parses it, looking for forms.
Since this package inherits from HTML::Parser, only the API unique to HTML::FormParser is described.
Each type of tag that might be found in a form can have three kinds of action associated with it via callbacks. Callbacks are passed to the parse() method, and take up to three forms.
o start_${tagname} Called whenever $tagname is opened. o ${tagname} Called immediately after start_${tagname}, and immediately before end_${tagname}. o end_${tagname} Called whenever a closing $tagname is encountered.
Each of these callbacks will be passed the attributes and original tag text as parameters, when called.
use HTML::FormParser; $p = HTML::FormParser->new(); $p->parse($html, start_form => sub { my ($attr, $origtext) = @_; print "Form action is $attr->{action}\n"; });
=head1 METHODS
This method will be called by the parser and is not intended to be called from an application.
This method will be called by the parser and is not intended to be called from an application.
Nothing.
o $p->parse()
should ideally accept different forms for the html parameter,
for example it should read from a stream or filehandle.
Simon Drabble <sdrabble@cpan.org> (C) 2002 Simon Drabble
This software is released under the same terms as perl.
HTML::FormParser - Do things with the contents of HTML forms. |