#!/usr/bin/perl use warnings; use strict; use CGI; use Template; my $cgi = CGI->new; my $tt = Template->new({ INCLUDE_PATH => 'templates', PRE_PROCESS => 'config:header', POST_PROCESS => 'footer', PRE_CHOMP => 1, POST_CHOMP => 1 }); print "Content-Type: text/html\n\n"; my $page = $cgi->param('page') || 'home'; my $vars = { page => $page }; $tt->process($page, $vars) || error($tt->error); sub error { my $error = shift; print <
Something has gone wrong. Here's what Template Toolkit had to say:
$error()HTML }