
         HTML::Template - a Perl module to use HTML Templates

CHANGES

2.7 Thu Jun 24 12:00:00 2004

   - New Feature: Added javascript escaping with ESCAPE=JS. (Craig Manley)

   - Bug Fix: Improved cache keying to be sensitive to options which
              alter the compilation of templates (path, search_path,
              loop_context_vars and global_vars).  Calls to new() with
              different settings for any of these options will no longer pull
              incorrect cached objects.

   - Bug Fix: Added code to detect broken Perl 5.8.0 installs
              during installation (i.e. Redhat 8 and 9).

   - Bug Fix: Fixed parsing of ESCAPE='URL' (Paul Baker)

   - Bug Fix: Added check for empty filename passed to new().

   - Test Fix: Migrated tests to Test::More.  This will allow the
               easier introduction of new tests and the use of
               Devel::Cover. (Gabor Szabo)

DESCRIPTION

This module attempts make using HTML templates simple and natural.  It
extends standard HTML with a few new HTML-esque tags - <TMPL_VAR>,
<TMPL_LOOP>, <TMPL_INCLUDE>, <TMPL_IF> and <TMPL_ELSE>.  The file
written with HTML and these new tags is called a template.  It is
usually saved separate from your script - possibly even created by
someone else!  Using this module you fill in the values for the
variables, loops and branches declared in the template.  This allows
you to seperate design - the HTML - from the data, which you generate
in the Perl script.

A Japanese translation of the documentation is available at:

   http://member.nifty.ne.jp/hippo2000/perltips/html/template.htm

MOTIVATION

It is true that there are a number of packages out there to do HTML
templates.  On the one hand you have things like HTML::Embperl which
allows you freely mix Perl with HTML.  On the other hand lie
home-grown variable substitution solutions.  Hopefully the module can
find a place between the two.

One advantage of this module over a full HTML::Embperl-esque solution
is that it enforces an important divide - design and programming.  By
limiting the programmer to just using simple variables and loops in
the HTML, the template remains accessible to designers and other
non-perl people.  The use of HTML-esque syntax goes further to make
the format understandable to others.  In the future this similarity
could be used to extend existing HTML editors/analyzers to support
this syntax.

An advantage of this module over home-grown tag-replacement schemes is
the support for loops.  In my work I am often called on to produce
tables of data in html.  Producing them using simplistic HTML
templates results in CGIs containing lots of HTML since the HTML
itself could not represent loops.  The introduction of loop statements
in the HTML simplifies this situation considerably.  The designer can
layout a single row and the programmer can fill it in as many times as
necessary - all they must agree on is the parameter names.

For all that, I think the best thing about this module is that it does
just one thing and it does it quickly and carefully.  It doesn't try
to replace Perl and HTML, it just augments them to interact a little
better.  And it's pretty fast.


DOCUMENTATION

The documentation is in Template.pm in the form of POD format
perldocs.  Even the above text might be out of date, so be sure to
check the perldocs for the straight truth!


INSTALLATION

In case this is your first module, the usual methods are:

        perl Makefile.PL
        make
        make test
        make install

If you plan to use the shared memory cache you might want to test it
before you install.  Make sure you have an up-to-date copy of
IPC::SharedCache installed (available from the same place you got
HTML::Template, either CPAN or SourceForge) and then do:

       TEST_SHARED_MEMORY=1 make test

CONTACT INFO

This module was written by Sam Tregar (sam@tregar.com) for Vanguard
Media (http://www.vm.com).  You can join the HTML::Template
mailing-list by sending a blank message to
htmltmpl-subscribe@lists.vm.com.

LICENSE

HTML::Template : A module for using HTML Templates with Perl
Copyright (C) 2000 Sam Tregar (sam@tregar.com)

This module is free software; you can redistribute it and/or modify it
under the terms of either:

a) the GNU General Public License as published by the Free Software
Foundation; either version 1, or (at your option) any later version,
or

b) the "Artistic License" which comes with this module.

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 either
the GNU General Public License or the Artistic License for more details.

You should have received a copy of the Artistic License with this
module, in the file ARTISTIC.  If not, I'll be glad to provide one.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
