|
NAMEHTML::FillInForm::Lite - Lightweight FillInForm module in Pure PerlVERSIONThe document describes HTML::FillInForm::Lite version 1.13SYNOPSISuse 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, \&my_param); $output = $h->fill('t.html', [$q, \%default]); # or as a class method with options $output = HTML::FillInForm::Lite->fill(\$html, $q, fill_password => 0, # it is default ignore_fields => ['foo', 'bar'], target => $form_id, ); # Moreover, it accepts any object as form data # (these classes come form Class::DBI's SYNOPSIS) my $artist = Music::Artist->insert({ id => 1, name => 'U2' }); $output = $h->fill(\$html, $artist); my $cd = Music::CD->retrieve(1); $output = $h->fill(\$html, $cd); # simple function interface use HTML::FillInForm::Lite qw(fillinform); # the same as HTML::FillInForm::Lite->fill(...) $output = fillinform(\$html, $q); DESCRIPTIONThis module fills in HTML forms with Perl data, which re-implements "HTML::FillInForm" using regexp-based parser, not using "HTML::Parser".The difference in the parsers makes "HTML::FillInForm::Lite" about 2 times faster than "HTML::FillInForm". FUNCTIONSfillinform(source, form_data)Simple interface to the "fill()" method, accepting only a string. If you pass a single argument to this function, it is interpreted as form_data, and returns a function that accepts source.my $fillinform = fillinform($query); $fillinform->($html); # the same as fillinform($html, $query) This function is exportable. METHODSnew(options...)Creates "HTML::FillInForm::Lite" processor with options.There are several options. All the options are disabled when "undef" is supplied. Acceptable options are as follows:
fill(source, form_data [, options...])Fills in source with form_data. If source or form_data is not supplied, it will cause "die".options are the same as "new()"'s. You can use this method as a both class or instance method, but you make multiple calls to "fill()" with the same options, it is a little faster to call "new()" and store the instance. source may be a scalar reference, an array reference of strings, or a file name. form_data may be a hash reference, an object with "param()" method, an object with accessors, a code reference, or an array reference of those above mentioned. If form_data is based on procedures (i.e. not a hash reference), the procedures will be called in the list context. Therefore, to leave some fields untouched, it must return a null list "()", not "undef". DEPENDENCIESPerl 5.8.1 or later.NOTESCompatibility with "HTML::FillInForm"This module implements only the new syntax of "HTML::FillInForm" version 2. However, "HTML::FillInForm::Lite::Compat" provides an interface compatible with "HTML::FillInForm".Compatibility with legacy HTMLThis module is designed to process XHTML 1.x.And it also supporting 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. Moreover, it doesn't recognize omitted closing tags, like: <select name="foo"> <option>bar <option>baz </select> When you can't get what you want, try to give your source to a HTML lint. Comment handlingThis module processes all the processable, 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::Lite" will break the code: <script> document.write("<input name='foo' value="bar" />") </script> To avoid such problems, you can use the "ignore_fields" option. BUGSNo bugs have been reported.Please report any bug or feature request to <gfuji(at)cpan.org>, or through the RT <http://rt.cpan.org/>. SEE ALSOHTML::FillInForm.HTML::FillInForm::Lite::JA - the document in Japanese. HTML::FillInForm::Lite::Compat - HTML::FillInForm compatibility layer AUTHORGoro Fuji (X XX) <gfuji(at)cpan.org>LICENSE AND COPYRIGHTCopyright (c) 2008-2010 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.
Visit the GSP FreeBSD Man Page Interface. |