HTML::FillInForm::Lite - Fills in HTML forms with data
The document describes HTML::FillInForm version 0.03
use HTML::FillInForm::Lite; use CGI; my $q = CGI->new(); my $h = HTML::FillInForm::Lite->new(); $output = $h->fill(\$html, $q); $output = $h->fill(\@html, \%data); $output = $h->fill(\*HTML, \&get_param); $output = $h->fill('t.html', [$q, \%default]); $output = $h->fill(\$html, $q, fill_password => 0, # it is default ignore_fields => ['foo', 'bar'], # or disable_fields => [...] target => $form_id, );
This module fills in HTML forms with Perl data, which re-implements HTML::FillInForm using regexp-based parser, not using HTML::Parser.
HTML::FillInForm
HTML::Parser
The difference in the parsers makes HTML::FillInForm::Lite 2 or more times faster than HTML::FillInForm.
HTML::FillInForm::Lite
Creates HTML::FillInForm::Lite processer with options.
There are several options. All the methods are disabled when undef is suplied.
undef
Acceptable options are as follows:
Unlike HTML::FillInForm, the fill() method ignores passwords by default.
fill()
To enable passwords to be filled in, set the option true.
To ignore some fields from filling.
To fill in just the form identified by form_id.
To ignore some types from filling.
Note that it is not implemented in HTML::FillInForm.
If true is provided (or by default), values filled in text fields will be html-escaped, e.g. <tag> to be <tag>.
<tag>
<tag>
The values are already html-escaped, set the option false.
If a code reference is provided, it will be used to escape the values.
Note that it not implemented in HTML::FillInForm.
Fills in source with form_data.
The options are the same as new()'s.
new()
You can use this method as both class or instance method, but you make multiple calls to fill() with the same options, it is a little faster to call new() before fill().
To clear all the fields, provide form_data with a subroutine returning an empty string, like:
HTML::FillInForm::Lite->fill($source, sub{ '' });
This is because if returning values are undefined, it will leave the elements untouched.
This module implements only the new syntax of HTML::FillInForm version 2.
It understands XHTML 1.x, and also supports a good part of HTML 4.x, but there are some limitations. First, it doesn't understand html-attributes that the name is omitted.
For example:
<INPUT TYPE=checkbox NAME=foo CHECKED> -- NG. <INPUT TYPE=checkbox NAME=foo CHECKED=CHECKED> - OK, but obsolete. <input type="checkbox" name="foo" checked="checked" /> - OK, valid XHTML
Then, it always treats the values of attributes case-sensitively. In the example above, the value of type must be lower-case.
type
This module processes all the processible, not knowing comments nor something that shouldn't be processed.
It may cause problems. Suppose there is a code like:
<script> document.write("<input name='foo' />") </script>
HTML::FillInForm will process the code to be broken:
<script> document.write("<input name='foo' value="bar" />") </script>
To avoid such problems, you can use the ignore_fields option.
ignore_fields
HTML::FillInForm.
Goro Fuji (藤 吾郎) <gfuji(at)cpan.org>
Copyright (c) 2008 Goro Fuji, Some rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::FillInForm::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::FillInForm::Lite
CPAN shell
perl -MCPAN -e shell install HTML::FillInForm::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.