bradcathey has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monasterians:

I'm trying to learn to use more modules, but not getting HTML::FillInForm. I have been using HTML::Template for some time, but want to refine my methods further. Here are my specific questions:

1. what is 'fobject'? and can it be called by any other name?

2. How does the $output get 'enacted'? I.e., how do I get from my Perl to my .tmpl form?

3. What else am I missing here?

PERL:

my $query = new CGI; $query -> param("123 Main Street"); my $html = "../form.html"; my $template = HTML::Template->new(filename => '../form.tmpl'); my $fif = new HTML::FillInForm; my $output = $fif->fill(scalarref => \$html, fobject => $query); print "Content-type: text/html\n\n"; print $template->output();

HTML:

<form action="cgi-bin/fill.pl" method="post"> <input type="text" name="address" size="30" /> <input type="submit" /> </form>

Thanks!

Update: Please see my findings, which are under the review of the HTML::FillInForm module itself.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: Need help understanding HTML::FillInForm
by johnnywang (Priest) on May 17, 2005 at 02:01 UTC
    I'm not familiar with HTML::Template, but HTML::FillForm works on HTML pages, so your order of processing is probably wrong: it should be template first, then use HTML::FillForm. HTML::FillForm bascially parses the raw html and does the correct form value substitution with the passed in fobject (which is the form object, i.e., anything that supports the param() method, in particular the CGI object.) Your $query->param() call should set the "address" parameter, i.e., $query->param("address", "123 Main Stree").

      Problems solved: Please see my findings, which are under the review of the HTML::FillInForm module itself.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot