##
use CGI;
$CGI = CGI->new();
####
use CGI qw(:standard);
use strict;
print header,start_html('CGI Test');
unless (param('go')) {
print start_form,
table(
Tr(
td('First Name:'),
td(textfield('fname')),
),
Tr(
td('Last Name:'),
td(textfield('lname')),
),
Tr(
td('Your age:'),
td(textfield('age')),
),
),
submit('go'), end_form,
;
}
else {
my $fname = param('fname');
my $lname = param('lname');
my $age = param('age');
print h2('Welcome!'),
p(qq|We're glad to see you $fname, members of the
$lname family are always welcome here. It's hard
to believe that you're already $age years old.
My how time flies.|),
end_html
;
}
####
use CGI;
use HTML::Template;
use strict;
my $q = CGI->new();
my $html = do {local $/;};
my $tmpl = HTML::Template->new(
scalarref => \$html,
associate => $q,
);
print $q->header,$tmpl->output();
__DATA__
CGI Test
Welcome!
We're glad to see you , members of the
family are always welcome here. It's
hard to believe that you're already years
old. My how time flies.