lhp@nereida:~/public_html/cgi-bin/tt$ cat -n ttcgi3.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Template;
5
6 $| = 1;
7 print "Content-type: text/html\n\n";
8
9 my $tt = Template->new({
10 WRAPPER => 'page'
11 });
12
13 my $vars = {
14 planet => 'Earth',
15 captain => 'Prostetnic Vogon Jeltz',
16 time => 'two of your earth minutes',
17 title => 'A test with tt',
18 bgcol => 'lightblue',
19 };
20
21
22
23 $tt->process(\*DATA, $vars)
24 || die $tt->error( );
25
26 __DATA__
27
28 [% FILTER html_para %]
29
30 People of [% planet %], your attention please.
31 This is [% captain %] of the
32 Galactic Hyperspace Planning Council.
33
34 As you will no doubt be aware, the plans
35 for development of the outlying regions
36 of the Galaxy require the building of a
37 hyperspatial express route through your
38 star system, and regrettably your planet
39 is one of those scheduled for destruction.
40
41 The process will take slightly less than
42 [% time %].
43
44 [% END %]
lhp@nereida:~/public_html/cgi-bin/tt$ cat -n page
1 <html>
2 <head>
3 <title>[% title %]</title>
4 </head>
5 <body bgcolor = [% bgcol %]>
6 [% content %]
7 <hr>
8 </body>
9 </html>
Casiano Rodríguez León
