JezK
Edit File: HTML::FillInForm::Lite.3pm
.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "HTML::FillInForm::Lite 3pm" .TH HTML::FillInForm::Lite 3pm "2016-08-21" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::FillInForm::Lite \- Lightweight FillInForm module in Pure Perl .SH "VERSION" .IX Header "VERSION" The document describes HTML::FillInForm::Lite version 1.15 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use HTML::FillInForm::Lite; \& use CGI; \& \& my $q = CGI\->new(); \& my $h = HTML::FillInForm::Lite\->new(); \& \& $output = $h\->fill(\e$html, $q); \& $output = $h\->fill(\e@html, \e%data); \& $output = $h\->fill(\e*HTML, \e&my_param); \& $output = $h\->fill(\*(Aqt.html\*(Aq, [$q, \e%default]); \& \& # or as a class method with options \& $output = HTML::FillInForm::Lite\->fill(\e$html, $q, \& fill_password => 0, # it is default \& ignore_fields => [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq], \& target => $form_id, \& ); \& \& # Moreover, it accepts any object as form data \& # (these classes come form Class::DBI\*(Aqs SYNOPSIS) \& \& my $artist = Music::Artist\->insert({ id => 1, name => \*(AqU2\*(Aq }); \& $output = $h\->fill(\e$html, $artist); \& \& my $cd = Music::CD\->retrieve(1); \& $output = $h\->fill(\e$html, $cd); \& \& # simple function interface \& use HTML::FillInForm::Lite qw(fillinform); \& \& # the same as HTML::FillInForm::Lite\->fill(...) \& $output = fillinform(\e$html, $q); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module fills in \s-1HTML\s0 forms with Perl data, which re-implements \f(CW\*(C`HTML::FillInForm\*(C'\fR using regexp-based parser, not using \f(CW\*(C`HTML::Parser\*(C'\fR. .PP The difference in the parsers makes \f(CW\*(C`HTML::FillInForm::Lite\*(C'\fR about 2 times faster than \f(CW\*(C`HTML::FillInForm\*(C'\fR. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "fillinform(source, form_data)" .IX Subsection "fillinform(source, form_data)" Simple interface to the \f(CW\*(C`fill()\*(C'\fR method, accepting only a string. If you pass a single argument to this function, it is interpreted as \&\fIform_data\fR, and returns a function that accepts \fIsource\fR. .PP .Vb 2 \& my $fillinform = fillinform($query); \& $fillinform\->($html); # the same as fillinform($html, $query) .Ve .PP This function is exportable. .SH "METHODS" .IX Header "METHODS" .SS "new(options...)" .IX Subsection "new(options...)" Creates \f(CW\*(C`HTML::FillInForm::Lite\*(C'\fR processor with \fIoptions\fR. .PP There are several options. All the options are disabled when \f(CW\*(C`undef\*(C'\fR is supplied. .PP Acceptable options are as follows: .IP "fill_password => \fIbool\fR" 4 .IX Item "fill_password => bool" To enable passwords to be filled in, set the option true. .Sp Note that the effect of the option is the same as that of \f(CW\*(C`HTML::FillInForm\*(C'\fR, but by default \f(CW\*(C`HTML::FillInForm::Lite\*(C'\fR ignores password fields. .IP "ignore_fields => \fIarray_ref_of_fields\fR" 4 .IX Item "ignore_fields => array_ref_of_fields" To ignore some fields from filling. .IP "target => \fIform_id\fR" 4 .IX Item "target => form_id" To fill in just the form identified by \fIform_id\fR. .IP "escape => \fIbool\fR | \fIref\fR" 4 .IX Item "escape => bool | ref" If true is provided (or by default), values filled in text fields will be HTML-escaped, e.g. \f(CW\*(C`<tag>\*(C'\fR to be \f(CW\*(C`<tag>\*(C'\fR. .Sp If the values are already HTML-escaped, set the option false. .Sp You can supply a subroutine reference to escape the values. .Sp Note that it is not implemented in \f(CW\*(C`HTML::FillInForm\*(C'\fR. .IP "decode_entity => \fIbool\fR | \fIref\fR" 4 .IX Item "decode_entity => bool | ref" If true is provided , \s-1HTML\s0 entities in state fields (namely, \f(CW\*(C`radio\*(C'\fR, \f(CW\*(C`checkbox\*(C'\fR and \f(CW\*(C`select\*(C'\fR) will be decoded, but normally it is not needed. .Sp You can also supply a subroutine reference to decode \s-1HTML\s0 entities. .Sp Note that \f(CW\*(C`HTML::FillInForm\*(C'\fR always decodes \s-1HTML\s0 entities in state fields, but not supports this option. .IP "layer => \fI:iolayer\fR" 4 .IX Item "layer => :iolayer" To read a file with \fI:iolayer\fR. It is used when a file name is supplied as \&\fIsource\fR. .Sp For example: .Sp .Vb 3 \& # To read a file encoded in UTF\-8 \& $fif = HTML::FillInForm::Lite\->new(layer => \*(Aq:utf8\*(Aq); \& $output = $fif\->fill($utf8_file, $fdat); \& \& # To read a file encoded in EUC\-JP \& $fif = HTML::FillInForm::Lite\->new(layer => \*(Aq:encoding(euc\-jp)\*(Aq); \& $output = $fif\->fill($eucjp_file, $fdat); .Ve .Sp Note that it is not implemented in \f(CW\*(C`HTML::FillInForm\*(C'\fR. .SS "fill(source, form_data [, options...])" .IX Subsection "fill(source, form_data [, options...])" Fills in \fIsource\fR with \fIform_data\fR. If \fIsource\fR or \fIform_data\fR is not supplied, it will cause \f(CW\*(C`die\*(C'\fR. .PP \&\fIoptions\fR are the same as \f(CW\*(C`new()\*(C'\fR's. .PP You can use this method as a both class or instance method, but you make multiple calls to \f(CW\*(C`fill()\*(C'\fR with the \fBsame\fR options, it is a little faster to call \f(CW\*(C`new()\*(C'\fR and store the instance. .PP \&\fIsource\fR may be a scalar reference, an array reference of strings, or a file name. .PP \&\fIform_data\fR may be a hash reference, an object with \f(CW\*(C`param()\*(C'\fR method, an object with accessors, a code reference, or an array reference of those above mentioned. .PP If \fIform_data\fR 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 \f(CW\*(C`()\*(C'\fR, not \f(CW\*(C`undef\*(C'\fR. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" Perl 5.8.1 or later. .SH "NOTES" .IX Header "NOTES" .ie n .SS "Compatibility with ""HTML::FillInForm""" .el .SS "Compatibility with \f(CWHTML::FillInForm\fP" .IX Subsection "Compatibility with HTML::FillInForm" This module implements only the new syntax of \f(CW\*(C`HTML::FillInForm\*(C'\fR version 2. However, \f(CW\*(C`HTML::FillInForm::Lite::Compat\*(C'\fR provides an interface compatible with \f(CW\*(C`HTML::FillInForm\*(C'\fR. .SS "Compatibility with legacy \s-1HTML\s0" .IX Subsection "Compatibility with legacy HTML" This module is designed to process \s-1XHTML 1\s0.x. .PP And it also supporting a good part of \s-1HTML 4\s0.x , but there are some limitations. First, it doesn't understand HTML-attributes that the name is omitted. .PP For example: .PP .Vb 3 \& <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 .Ve .PP Then, it always treats the values of attributes case-sensitively. In the example above, the value of \f(CW\*(C`type\*(C'\fR must be lower-case. .PP Moreover, it doesn't recognize omitted closing tags, like: .PP .Vb 4 \& <select name="foo"> \& <option>bar \& <option>baz \& </select> .Ve .PP When you can't get what you want, try to give your source to a \s-1HTML\s0 lint. .SS "Comment handling" .IX Subsection "Comment handling" This module processes all the processable, not knowing comments nor something that shouldn't be processed. .PP It may cause problems. Suppose there is a code like: .PP .Vb 1 \& <script> document.write("<input name=\*(Aqfoo\*(Aq />") </script> .Ve .PP \&\f(CW\*(C`HTML::FillInForm::Lite\*(C'\fR will break the code: .PP .Vb 1 \& <script> document.write("<input name=\*(Aqfoo\*(Aq value="bar" />") </script> .Ve .PP To avoid such problems, you can use the \f(CW\*(C`ignore_fields\*(C'\fR option. .SH "BUGS" .IX Header "BUGS" No bugs have been reported. .PP Please report any bug or feature request to <gfuji(at)cpan.org>, or through the \s-1RT\s0 <http://rt.cpan.org/>. .SH "SEE ALSO" .IX Header "SEE ALSO" HTML::FillInForm. .PP HTML::FillInForm::Lite::JA \- the document in Japanese. .PP HTML::FillInForm::Lite::Compat \- HTML::FillInForm compatibility layer .SH "AUTHOR" .IX Header "AUTHOR" Goro Fuji (X \s-1XX\s0) <gfuji(at)cpan.org> .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (c) 2008\-2010 Goro Fuji, Some rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.