Generate web page


We are building the HTML pages from a template utilizing the HTML::Template module from CPAN. Besides the plain HTML the template has additional TMPL_* tags that will be filled by the values by HTML::Template.


examples/applications/html.tmpl
<html>
<head>
</head>
<body>

<TMPL_IF echo>
  You typed <TMPL_VAR echo>
</TMPL_IF>

<form>
   <input name="text">
   <input type=submit" value="Echo">
</form>

</body>
</html>

This is a simple Perl script that should be installed to a CGIExec enabled directory of Apache. When the user hits this page the first time it displays a white page with only entry-box and a submit button on it. the user can fill the box,


examples/applications/html.pl
#!/usr/bin/env perl
use strict;
use warnings;

use CGI;
use HTML::Template;

my $template = HTML::Template->new(filename => "examples/html.tmpl");
my $q = CGI->new;
print $q->header;


if ($q->param("text")) {
    my $text = $q->param("text");
    $template->param(echo => $text);
}
print $template->output