# template output 1
# prints school names as well
# school names are stored in @options
# this part works
# @options already set prior to setting up the template params
my %hash;
%hash (
des => 'Form 1',
# field label
label => 'Label 1',
# name of field
field => 'field1',
# size of text input field
value => '5',
submit => 'submit',
if_more => 'true',
# list of schools
options => \@options,
);
# call generate to output the template
generate(\%hash);
# template output 2
# don't print school names
%hash (
des => 'Form 2',
# field label
label => 'Label 2',
# name of field
field => 'field2',
# size of text input field
value => '10',
submit => 'submit',
if_more => 0,
);
generate(\%hash);
sub generate {
my $hashref = shift;
my $template = HTML::Template -> new(filename => "$tmpldir/generic.tt");
$template ->param(
des => $hashref->{'des'},
form => $hashref->{'form'},
action => $hashref->{'action'},
label => $hashref->{'label'},
field => $hashref->{'field'},
value => $hashref->{'value'},
submit => 'submit',
if_more => $hashref->{'if_more'},
options => $hashref->{'options'},
);
print $template->output;
}