Template::Simple 0.01 review

Download
by rbytes.net on

Template::Simple is a simple and fast template module. SYNOPSIS use Template::Simple; my $tmpl = Template::Simple->n

License: Perl Artistic License
File size: 15K
Developer: Uri Guttman
0 stars award from rbytes.net

Template::Simple is a simple and fast template module.

SYNOPSIS

use Template::Simple;

my $tmpl = Template::Simple->new();

my $template = 'Jan 1, 2008',
author => 'Me, myself and I',
},
row => [
{
first => 'row 1 value 1',
second => 'row 1 value 2',
},
{
first => 'row 2 value 1',
second => 'row 2 value 2',
},
],
footer_data => {
modified => 'Aug 31, 2006',
},
} ;

my $rendered = $tmpl->render( $template, $data ) ;

Template::Simple has these goals:

Support most common template operations

It can recursively include other templates, replace tokens (scalars), recursively render nested chunks of text and render lists. By using simple idioms you can get conditional renderings.
Complete isolation of template from program code

This is very important as template design can be done by different people than the program logic. It is rare that one person is well skilled in both template design and also programming.
Very simple template markup (only 4 markups)

The only markups are INCLUDE, START, END and token. See MARKUP for more.

Easy to follow rendering rules

Rendering of templates and chunks is driven from a data tree. The type of the data element used in an rendering controls how the rendering happens. The data element can be a scalar or scalar reference or an array, hash or code reference.

Efficient template rendering

Rendering is very simple and uses Perl's regular expressions efficiently. Because the markup is so simple less processing is needed than many other templaters. Precompiling templates is not supported yet but that optimization is on the TODO list.

Easy user extensions

User code can be called during an rendering so you can do custom renderings and plugins. Closures can be used so the code can have its own private data for use in rendering its template chunk.

Requirements:
Perl

Template::Simple 0.01 search tags