Template-Plex

 view release on metacpan or  search on metacpan

examples/html.pl  view on Meta::CPAN

use strict;
use warnings;
use feature ":all";
use File::Basename qw<dirname>;

use Template::Plex;

my $root=dirname __FILE__;

my %hash=(title=>"hello");

my $template=Template::Plex->load("html.plex"=>\%hash, root=>$root);

say "Original base/lexical value and field value";
say $template->render({title=>"Jacky"});

#Updated base/lexical variable
$hash{title}="goodbye";

#rendered with updated field values
say "\n" x 2;
say "Updated base/lexical values and field values";
say $template->render({title=>"Johny"});



( run in 1.986 second using v1.01-cache-2.11-cpan-8f9af2631e0 )