my ($tree, $hashref)=@_;
+ (ref $hashref) eq 'HASH' or die 'hashref not supplied as argument' ;
+
use HTML::FillInForm;
my $html = $tree->as_HTML;
my $new_html = HTML::FillInForm->fill(\$html, $hashref);
--- /dev/null
+# This might look like shell script, but it's actually -*- perl -*-
+use strict;use warnings;
+use lib qw(t/ t/m/);
+
+use File::Slurp;
+use Test::More qw(no_plan);
+
+use TestUtils;
+use HTML::TreeBuilder;
+use HTML::Element::Library;
+
+sub tage {
+
+ my $root = "t/html/fillinform/fillinform";
+
+ my $tree = HTML::TreeBuilder->new_from_file("$root.initial")->guts;
+
+ my %data = (state => 'catatonic');
+
+ my $new_tree = HTML::TreeBuilder->new_from_content( $tree->fillinform(\%data) ) ;
+
+ my $generated_html = ptree($new_tree, "$root.gen");
+
+ is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for fillinform");
+}
+
+
+tage();
+
--- /dev/null
+<html>
+ <head></head>
+ <body>
+ <div>
+ <h1>Dialer</h1>
+ <form name="appform" id="appform" method="post">
+ <div id="city_div"> City:
+ <input /="/" name="city" type="text">
+ </div>
+ <div id="state_div"> State:
+ <input /="/" value="catatonic" name="state" type="text">
+ </div>
+ <div id="company_div"> Company:
+ <input /="/" name="company" type="text">
+ </div>
+ <div id="data_source_div"> Data Source:
+ <input /="/" name="data_source" type="text">
+ </div>
+ <input /="/" value="locate records" type="submit">
+ </form>
+ </div>
+ </body>
+</html>
--- /dev/null
+<html>
+ <head></head>
+ <body>
+ <div>
+ <h1>Dialer</h1>
+ <form name="appform" id="appform" method="post">
+ <div id="city_div"> City:
+ <input /="/" name="city" type="text">
+ </div>
+ <div id="state_div"> State:
+ <input /="/" value="catatonic" name="state" type="text">
+ </div>
+ <div id="company_div"> Company:
+ <input /="/" name="company" type="text">
+ </div>
+ <div id="data_source_div"> Data Source:
+ <input /="/" name="data_source" type="text">
+ </div>
+ <input /="/" value="locate records" type="submit">
+ </form>
+ </div>
+ </body>
+</html>
--- /dev/null
+ <div>
+ <h1>Dialer</h1>
+
+ <form id="appform" method="post" name="appform">
+ <div id="city_div">
+ City: <input type="text" name="city">
+ </div>
+
+ <div id="state_div">
+ State: <input type="text" name="state">
+ </div>
+
+ <div id="company_div">
+ Company: <input type="text" name="company">
+ </div>
+
+ <div id="data_source_div">
+ Data Source: <input type="text" name="data_source">
+ </div><input type="submit" value="locate records">
+ </form>
+ </div>