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.


<TMPL_IF echo>
  You typed <TMPL_VAR echo>

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


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,

#!/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