Current File : //home/strato/chroot/opt/RZperl536/man/man3/CGI::FastTemplate.3
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "FastTemplate 3"
.TH FastTemplate 3 "1999-06-28" "perl v5.36.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
CGI::FastTemplate \- Perl extension for managing templates, and performing variable interpolation.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  use CGI::FastTemplate;
\&
\&  $tpl = new CGI::FastTemplate();
\&  $tpl = new CGI::FastTemplate("/path/to/templates");
\&
\&  CGI::FastTemplate\->set_root("/path/to/templates");    ## all instances will use this path
\&  $tpl\->set_root("/path/to/templates");                 ## this instance will use this path
\&
\&  $tpl\->define( main    => "main.tpl",
\&                row     => "table_row.tpl",
\&                all     => "table_all.tpl",
\&                );
\&
\&  $tpl\->assign(TITLE => "I am the title.");
\&
\&  my %defaults = (  FONT   => "<font size=+2 face=helvetica>",
\&                    EMAIL   => \*(Aqjmoore@sober.com\*(Aq,
\&                    );   
\&  $tpl\->assign(\e%defaults);
\&
\&  $tpl\->parse(ROWS      => ".row");      ## the \*(Aq.\*(Aq appends to ROWS
\&  $tpl\->parse(CONTENT   => ["row", "all"]);
\&  $tpl\->parse(CONTENT   => "main");
\&
\&  $tpl\->print();            ## defaults to last parsed
\&  $tpl\->print("CONTENT");   ## same as print() as "CONTENT" was last parsed
\&
\&  $ref = $tpl\->fetch("CONTENT");
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.SS "What is a template?"
.IX Subsection "What is a template?"
A template is a text file with variables in it.  When a template is
parsed, the variables are interpolated to text.  (The text can be a few
bytes or a few hundred kilobytes.)  Here is a simple template with one
variable ('$NAME'):
.PP
.Vb 1
\&  Hello $NAME.  How are you?
.Ve
.SS "When are templates useful?"
.IX Subsection "When are templates useful?"
Templates are very useful for \s-1CGI\s0 programming, because adding \s-1HTML\s0 to your
perl code clutters your code and forces you to do any \s-1HTML\s0 modifications.
By putting all of your \s-1HTML\s0 in separate template files, you can let
a graphic or interface designer change the look of your application
without having to bug you, or let them muck around in your perl code.
.SS "There are other templating modules on \s-1CPAN,\s0 what makes FastTemplate different?"
.IX Subsection "There are other templating modules on CPAN, what makes FastTemplate different?"
CGI::FastTemplate has the following attributes:
.PP
\&\fBSpeed\fR
.PP
FastTemplate doesn't use eval, and parses with a single regular
expression.  It just does simple variable interpolation (i.e. there is
no logic that you can add to templates \- you keep the logic in the code).
That's why it's has 'Fast' in it's name!
.PP
\&\fBEfficiency\fR
.PP
FastTemplate functions accept and return references whenever possible, which saves
needless copying of arguments (hashes, scalars, etc).
.PP
\&\fBFlexibility\fR
.PP
The \s-1API\s0 is robust and flexible, and allows you to build very complex \s-1HTML\s0
documents or \s-1HTML\s0 interfaces.  It is 100% perl and works on Unix or \s-1NT.\s0
Also, it isn't restricted to building \s-1HTML\s0 documents \*(-- it could be used
to build any ascii based document (e.g. postscript, \s-1XML,\s0 email).
.PP
The similar modules on \s-1CPAN\s0 are:
.PP
.Vb 5
\&  Module          HTML::Template  (S/SA/SAMTREGAR/HTML\-Template\-0.04.tar.gz)
\&  Module          Taco::Template  (KWILLIAMS/Taco\-0.04.tar.gz)
\&  Module          Text::BasicTemplate (D/DC/DCARRAWAY/Text\-BasicTemplate\-0.9.8.tar.gz)
\&  Module          Text::Template  (MJD/Text\-Template\-1.20.tar.gz)
\&  Module          HTML::Mason     (J/JS/JSWARTZ/HTML\-Mason\-0.5.1.tar.gz)
.Ve
.SS "What are the steps to use FastTemplate?"
.IX Subsection "What are the steps to use FastTemplate?"
The main steps are:
.PP
.Vb 4
\&    1. define
\&    2. assign 
\&    3. parse
\&    4. print
.Ve
.PP
These are outlined in detail in \s-1CORE METHODS\s0 below.
.SH "CORE METHODS"
.IX Header "CORE METHODS"
.SS "define(\s-1HASH\s0)"
.IX Subsection "define(HASH)"
The method \fBdefine()\fR maps a template filename to a (usually shorter) name. e.g.
.PP
.Vb 4
\&    my $tpl = new FastTemplate();
\&    $tpl\->define(   main   => "main.tpl",
\&                    footer   => "footer.tpl",
\&                    );
.Ve
.PP
This new name is the name that you will use to refer to the templates.  Filenames
should not appear in any place other than a \fBdefine()\fR.
.PP
(Note: This is a required step!  This may seem like an annoying extra
step when you are dealing with a trivial example like the one above,
but when you are dealing with dozens of templates, it is very handy to
refer to templates with names that are indepandant of filenames.)
.PP
\&\s-1TIP:\s0 Since \fBdefine()\fR does not actually load the templates, it is faster
and more legible to define all the templates with one call to \fBdefine()\fR.
.SS "define_nofile(\s-1HASH\s0)   alias: define_raw(\s-1HASH\s0)"
.IX Subsection "define_nofile(HASH) alias: define_raw(HASH)"
Sometimes it is desireable to not have to create a separate template file
for each template (though in the long run it is usually better to do so).
The method \fBdefine_nofile()\fR allows you to do this.  For example, if you
were writing a news tool where you wanted to bold an item if it was
\&\*(L"new\*(R" you could do something like the following:
.PP
.Vb 1
\&    my $tpl = new FastTemplate();
\&
\&    $tpl\->define_nofile(    new   => \*(Aq<b>$ITEM_NAME</b> <BR>\*(Aq,
\&                            old   => \*(Aq$ITEM_NAME <BR>\*(Aq);
\&
\&    if ($new)
\&    {
\&        $tpl\->parse($ITEM   => "new");
\&    }
\&    else
\&    {
\&        $tpl\->parse($ITEM   => "old");
\&    }
.Ve
.PP
Of course, now you, the programmer has to update how new items are
displayed, whereas if it was in a template, you could offload that task
to someone else.
.SS "define_nofile(\s-1HASH REF\s0)   alias: define_raw(\s-1HASH REF\s0)"
.IX Subsection "define_nofile(HASH REF) alias: define_raw(HASH REF)"
A more efficient way of passing your arguments than using a real hash.
Just pass in a hash reference instead of a real hash.
.SS "assign(\s-1HASH\s0)"
.IX Subsection "assign(HASH)"
The method \fBassign()\fR assigns values for variables.  In order for a variable
in a template to be interpolated it must be assigned.  There are two forms
which have some important differences.  The simple form, is to accept
a hash and copy all the key/value pairs into a hash in FastTemplate.
There is only one hash in FastTemplate, so assigning a value for the
same key will overwrite that key.
.PP
.Vb 1
\&    e.g.
\&
\&    $tpl\->assign(TITLE   => "king kong");
\&    $tpl\->assign(TITLE   => "godzilla");    ## overwrites "king kong"
.Ve
.SS "assign(\s-1HASH REF\s0)"
.IX Subsection "assign(HASH REF)"
A much more efficient way to pass in values is to pass in a hash
reference.  (This is particularly nice if you get back a hash or hash
reference from a database query.)  Passing a hash reference doesn't copy
the data, but simply keeps the reference in an array.  During parsing if
the value for a variable cannot be found in the main FastTemplate hash,
it starts to look through the array of hash references for the value.
As soon as it finds the value it stops.  It is important to remember to
remove hash references when they are no longer needed.
.PP
.Vb 1
\&    e.g.
\&
\&    my %foo = ("TITLE" => "king kong");
\&    my %bar = ("TITLE" => "godzilla");
\&
\&    $tpl\->assign(\e%foo);   ## TITLE resolves to "king kong"
\&    $tpl\->clear_href(1);   ## remove last hash ref assignment (\e%foo)
\&    $tpl\->assign(\e%bar);   ## TITLE resolves to "godzilla"
\&
\&    $tpl\->clear_href();    ## remove all hash ref assignments
\&
\&    $tpl\->assign(\e%foo);   ## TITLE resolves to "king kong"
\&    $tpl\->assign(\e%bar);   ## TITLE _still_ resolves to "king kong"
.Ve
.SS "parse(\s-1HASH\s0)"
.IX Subsection "parse(HASH)"
The parse function is the main function in FastTemplate.  It accepts
a hash, where the keys are the \s-1TARGET\s0 and the values are the \s-1SOURCE\s0
templates.  There are three forms the hash can be in:
.PP
.Vb 1
\&    $tpl\->parse(MAIN => "main");                ## regular
\&
\&    $tpl\->parse(MAIN => ["table", "main"]);     ## compound
\&
\&    $tpl\->parse(MAIN => ".row");                ## append
.Ve
.PP
In the regular version, the template named \*(L"main\*(R" is loaded if it hasn't
been already, all the variables are interpolated, and the result is
then stored in FastTemplate as the value \s-1MAIN.\s0  If the variable '$MAIN'
shows up in a later template, it will be interpolated to be the value of
the parsed \*(L"main\*(R" template.  This allows you to easily nest templates,
which brings us to the compound style.
.PP
The compound style is designed to make it easier to nest templates.
The following are equivalent:
.PP
.Vb 2
\&    $tpl\->parse(MAIN => "table");      
\&    $tpl\->parse(MAIN => "main");
\&
\&    ## is the same as:
\&
\&    $tpl\->parse(MAIN => ["table", "main"]);     ## this form saves function calls
\&                                                ## (and makes your code cleaner)
.Ve
.PP
It is important to note that when you are using the compound form,
each template after the first, must contain the variable that you are
parsing the results into.  In the above example, 'main' must contain
the variable '$MAIN', as that is where the parsed results of 'table'
is stored.  If 'main' does not contain the variable '$MAIN' then the
parsed results of 'table' will be lost.
.PP
The append style is a bit of a kludge, but it allows you to append
the parsed results to the target variable.  This is most useful when
building tables that have an dynamic number of rows \- such as data from
a database query.
.SS "\fBstrict()\fP"
.IX Subsection "strict()"
When \fBstrict()\fR is on (it is on by default) all variables found during
template parsing that are unresolved have a warning printed to \s-1STDERR.\s0
e.g.
.PP
.Vb 1
\&   [CGI::FastTemplate] Warning: no value found for variable: SOME_VARIABLE
.Ve
.PP
Also, new as of version 1.04 the variables will be left in the output
document.  This was done for two reasons: to allow for parsing to be done
in stages (i.e. multiple passes), and to make it easier to identify
undefined variables since they appear in the parsed output.
If you have been using an earlier version of FastTemplate and you want
the old behavior of replacing unknown variables with an empty string,
see: \fBno_strict()\fR.
.PP
Note: version 1.07 adds support for two styles of variables, so that the
following are equivalent: \f(CW$VAR\fR and ${\s-1VAR\s0} However, when using \fBstrict()\fR,
variables with curly brackets that are not resolved are outputted as
plain variables.  e.g. if ${\s-1VAR\s0} has no value assigned to it, it would
appear in the output as \f(CW$VAR\fR.  This is a slight inconsistency \*(-- ideally
the unresolved variable would remain unchanged.
.PP
Note: \s-1STDERR\s0 output should be captured and logged by the webserver so you
can just tail the error log to see the output.
.PP
.Vb 1
\&    e.g.
\&
\&    tail \-f /etc/httpd/logs/error_log
.Ve
.SS "\fBno_strict()\fP"
.IX Subsection "no_strict()"
Turns off warning messages about unresolved template variables.
As of version 1.04 a call to \fBno_strict()\fR is required to replace unknown
variables with an empty string.  By default, all instances of FastTemplate
behave as is \fBstrict()\fR was called.  Also, \fBno_strict()\fR must be set for
each instance of CGI::FastTemplate. e.g.
.PP
.Vb 1
\&   CGI::FastTemplate::no_strict;        ## no 
\&   
\&   my $tpl = CGI::FastTemplate;
\&   $tpl\->no_strict;                     ## yes
.Ve
.SS "print(\s-1SCALAR\s0)"
.IX Subsection "print(SCALAR)"
The method \fBprint()\fR prints the contents of the named variable.  If no
variable is given, then it prints the last variable that was used in a
call to parse which I find is a reasonable default.
.PP
.Vb 1
\&    e.g.
\&
\&    $tpl\->parse(MAIN => "main");
\&    $tpl\->print();         ## prints value of MAIN
\&    $tpl\->print("MAIN");   ## same
.Ve
.PP
This method is provided for convenience.
.PP
If you need to print other than \s-1STDOUT\s0 (e.g. socket, file handle) see \fBfetch()\fR.
.SH "OTHER METHODS"
.IX Header "OTHER METHODS"
.SS "fetch(\s-1SCALAR\s0)"
.IX Subsection "fetch(SCALAR)"
Returns a scalar reference to parsed data.
.PP
.Vb 2
\&    $tpl\->parse(CONTENT   => "main");
\&    my $content = $tpl\->fetch("CONTENT");   
\&
\&    print $$content;        ## print to STDOUT
\&    print FILE $$content;   ## print to filehandle or pipe
.Ve
.SS "\fBclear()\fP"
.IX Subsection "clear()"
Note: All of 'clear' functions are for use under mod_perl (or anywhere
where your scripts are persistant).  They generally aren't needed if
you are writing \s-1CGI\s0 scripts.
.PP
Clears the internal hash that stores data passed from calls to \fBassign()\fR and \fBparse()\fR.
.PP
Often \fBclear()\fR is at the end of a mod_perl script:
.PP
.Vb 2
\&    $tpl\->print();
\&    $tpl\->clear();
.Ve
.SS "clear(\s-1ARRAY\s0)"
.IX Subsection "clear(ARRAY)"
With no arguments, all assigned or parsed variables are cleared, but if passed an \s-1ARRAY\s0 of variable names, then only
those variables will be cleared.
.PP
.Vb 1
\&  e.g. 
\&
\&  $tpl\->assign(TITLE => "Welcome"); 
\&  $tpl\->clear("TITLE");                 ## title is now empty
.Ve
.PP
Another way of achieving the same effect of clearnign variables is to just assign an empty string.
.PP
.Vb 1
\&  e.g.
\&
\&  $tpl\->assign(TITLE => \*(Aq\*(Aq);           ## same as: $tpl\->clear("TITLE");
.Ve
.SS "\fBclear_parse()\fP"
.IX Subsection "clear_parse()"
See: \fBclear()\fR
.SS "clear_href(\s-1NUMBER\s0)"
.IX Subsection "clear_href(NUMBER)"
Removes a given number of hash references from the list of hash refs that is built using:
.PP
.Vb 1
\&    $tpl\->assign(HASH REF);
.Ve
.PP
If called with no arguments, it removes all hash references
from the array.  This is often used for database queries where each row from the query
is a hash or hash reference.
.PP
e.g.
.PP
.Vb 6
\&    while($hash_row = $sth\->fetchrow_hashref)
\&    {
\&        $tpl\->assign($hash_row);
\&        $tpl\->parse(ROW => ".row");
\&        $tpl\->clear_href(1);
\&    }
.Ve
.SS "\fBclear_define()\fP"
.IX Subsection "clear_define()"
Clears the internal hash that stores data passed to:
.PP
.Vb 1
\&    $tpl\->define();
.Ve
.PP
Note: The hash that holds the loaded templates is not touched with
this method.  See: clear_tpl
.SS "\fBclear_tpl()\fP clear_tpl(\s-1NAME\s0)"
.IX Subsection "clear_tpl() clear_tpl(NAME)"
The first time a template is used, it is loaded and stored in a hash
in memory.  \fBclear_tpl()\fR removes all the templates being held in memory.
clear_tpl(\s-1NAME\s0) only removes the one with \s-1NAME.\s0  This is generally not
required for normal \s-1CGI\s0 programming, but if you have long running scripts
(e.g. mod_perl) and have very large templates that a re infrequently
used gives you some control over how memory is being used.
.SS "\fBclear_all()\fP"
.IX Subsection "clear_all()"
Cleans the module of any data, except for the \s-1ROOT\s0 directory.  Equivalent to:
.PP
.Vb 4
\&    $tpl\->clear_define();
\&    $tpl\->clear_href();
\&    $tpl\->clear_tpl();
\&    $tpl\->clear_parse();
.Ve
.SS "Variables"
.IX Subsection "Variables"
A variable is defined as:
.PP
.Vb 1
\&    $[A\-Z0\-9][A\-Z0\-9_]+
.Ve
.PP
This means, that a variable must begin with a dollar sign '$'.
The second character must be an uppercase letter or digit 'A\-Z0\-9'.
Remaining characters can include an underscore.
.PP
As of version 1.07 variables can also be delimited by curly brackets.
.PP
.Vb 1
\&    ${[A\-Z0\-9][A\-Z0\-9_]+}
.Ve
.PP
For example, the following are valid variables:
.PP
.Vb 4
\&    $FOO
\&    $F123F
\&    $TOP_OF_PAGE
\&    ${NEW_STYLE}
.Ve
.SS "Variable Interpolation (Template Parsing)"
.IX Subsection "Variable Interpolation (Template Parsing)"
When the a template is being scanned for variables, pattern matching
is greedy. (For more info on \*(L"greediness\*(R" of regexps see perlre.)
This is important, because if there are valid variable characters after
your variable, FastTemplate will consider them to be part of the variable.
As of version 1.07 you can use curly brackets as delimiters for your
variable names.  e.g. ${\s-1VARIABLE\s0}  You do not need to use curly brackets
if the character immediately after your variable name is not an uppercase
letter, digit or underscore.  ['A\-Z0\-9_']
.PP
If a variable cannot be resolved to a value then there are two
possibilities.  If \fBstrict()\fR has been called (it is on by default) then
the variable remains and a warning is printed to \s-1STDERR.\s0   If \fBno_strict()\fR
has been called then the variables is converted to an empty string [''].
.PP
See \fBstrict()\fR and \fBno_strict()\fR for more info.
.PP
Some examples will make this clearer.
.PP
.Vb 1
\&    Assume:
\&
\&    $FOO = "foo";
\&    $BAR = "bar";
\&    $ONE = "1";
\&    $TWO = "2";   
\&    $UND = "_";
\&   
\&    Variable        Interpolated/Parsed
\&    \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&    $FOO            foo   
\&    $FOO\-$BAR       foo\-bar
\&    $ONE_$TWO       2             ## $ONE_ is undefined!
\&    $ONE_$TWO       $ONE_2        ## assume: strict()
\&    $ONE$UND$TWO    1_2           ## kludge!
\&    ${ONE}_$TWO     1_2           ## much better
\&    $$FOO           $foo
\&    $25,000         $25,000
.Ve
.SS "\s-1FULL EXAMPLE\s0"
.IX Subsection "FULL EXAMPLE"
This example will build an \s-1HTML\s0 page that will consist of a table.
The table will have 3 numbered rows.  The first step is to decide what
templates we need.  In order to make it easy for the table to change to
a different number of rows, we will have a template for the rows of the
table, another for the table, and a third for the head/body part of the
\&\s-1HTML\s0 page.
.PP
Below are the templates. (Pretend each one is in a separate file.)
.PP
.Vb 9
\&  <!\-\- NAME: main.tpl \-\->
\&  <html>
\&  <head><title>$TITLE</title>
\&  </head>
\&  <body>
\&  $MAIN
\&  </body>
\&  </html>
\&  <!\-\- END: main.tpl \-\->
\& 
\& 
\&  <!\-\- NAME: table.tpl \-\->
\&  <table>
\&  $ROWS
\&  </table>
\&  <!\-\- END: table.tpl \-\->
\& 
\& 
\&  <!\-\- NAME: row.tpl \-\->
\&  <tr>
\&  <td>$NUMBER</td>
\&  <td>$BIG_NUMBER</td>
\&  </tr>
\&  <!\-\- END: row.tpl \-\->
.Ve
.PP
Now we can start coding...
.PP
.Vb 1
\&  ## START ##
\&
\&  use CGI::FastTemplate;
\&  my $tpl = new CGI::FastTemplate("/path/to/template/files");
\& 
\&  $tpl\->define(     main    => "main.tpl",
\&                    table   => "table.tpl",
\&                    row     => "row.tpl",
\&                    );
\&
\&  $tpl\->assign(TITLE => "FastTemplate Test");
\&
\&  for $n (1..3) 
\&  {
\&        $tpl\->assign(   NUMBER      => $n,   
\&        BIG_NUMBER   => $n*10);
\&        $tpl\->parse(ROWS   => ".row"); 
\&  }
\&
\&  $tpl\->parse(MAIN => ["table", "main"]); 
\&  $tpl\->print();
\&
\&  ## END ##
\& 
\&  When run it returns:
\&
\&  <!\-\- NAME: main.tpl \-\->
\&  <html>
\&  <head><title>FastTemplate Test</title>
\&  </head>
\&  <body>
\&  <!\-\- NAME: table.tpl \-\->
\&  <table>
\&  <!\-\- NAME: row.tpl \-\->
\&  <tr>
\&  <td>1</td>
\&  <td>10</td>
\&  </tr>
\&  <!\-\- END: row.tpl \-\->
\&  <!\-\- NAME: row.tpl \-\->
\&  <tr>
\&  <td>2</td>
\&  <td>20</td>
\&  </tr>
\&  <!\-\- END: row.tpl \-\->
\&  <!\-\- NAME: row.tpl \-\->
\&  <tr>
\&  <td>3</td>
\&  <td>30</td>
\&  </tr>
\&  <!\-\- END: row.tpl \-\->
\&  
\&  </table>
\&  <!\-\- END: table.tpl \-\->
\&
\&  </body>
\&  </html>
\&  <!\-\- END: main.tpl \-\->
.Ve
.PP
If you're thinking you could have done the same thing in a few lines
of plain perl, well yes you probably could.  But, how would a graphic
designer tweak the resulting \s-1HTML\s0?  How would you have a designer editing
the \s-1HTML\s0 while you're editing another part of the code?  How would
you save the output to a file, or pipe it to another application
(e.g. sendmail)?  How would you make your application multi-lingual?
How would you build an application that has options for high graphics,
or text-only?  FastTemplate really starts to shine when you are building
mid to large scale web applications, simply because it begins to separate
the application's generic logic from the specific implementation.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
.Vb 2
\&        Copyright (c) 1998\-99 Jason Moore <jmoore@sober.com>.  All rights
\&        reserved.
\&
\&        This program is free software; you can redistribute it and/or
\&        modify it under the same terms as Perl itself.
\&
\&        This program is distributed in the hope that it will be useful,
\&        but WITHOUT ANY WARRANTY; without even the implied warranty of
\&        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
\&        Artistic License for more details.
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Jason Moore <jmoore@sober.com>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBmod_perl\fR\|(1).