Template::Magic 1.38 review
Download
|
|
Template::Magic is a Perl module for magic merger of runtime values with templates.
SYNOPSIS
Just add these 2 magic lines to your code...
use Template::Magic;
Template::Magic->new->print( '/path/to/template' );
to have all your variable and subroutines merged with the template file, or set one or more constructor array to customize the output generation as you need:
use Template::Magic qw( -compile );
$tm = new Template::Magic
paths => [ qw(/any/path /any/other/path) ] ,
markers => [ qw( < / > ) ] ,
lookups => [ %my_hash, $my_obj, 'main' ] ,
zone_handlers => [ &my_zone_handler, '_EVAL_' ] ,
value_handlers => [ 'DEFAULT', &my_value_handler ] ,
text_handlers => sub {print lc $_[1]} ,
output_handlers => sub {print uc $_[1]} ,
post_handlers => &my_post_handler ,
options => 'no_cache' ;
$tm->nprint( template => '/path/to/template'
lookups => %my_special_hash );
Requirements:
Perl version >= 5.6.1
OOTools >= 2
IO::Util >= 1.46
File::Spec >= 0
Template::Magic 1.38 search tags