Plift::Context - Template data and instructions to be rendered.
use Plift; my $plift = Plift->new( path => \@paths, # default ['.'] plugins => [qw/ Script Blog Gallery GoogleMap /], # plugins not included ); my $tpl = $plift->template("index"); # set render directives $tpl->at({ '#name' => 'fullname', '#contact' => [ '.phone' => 'contact.phone', '.email' => 'contact.email' ] }); # render render with data my $document = $tpl->render({ fullname => 'Carlos Fernando Avila Gratz', contact => { phone => '+55 27 1234-5678', email => 'cafe@example.com' } });
Adds on or more render directives.
Set data to be rendered.
Get data via a dotted data-point string.
$context->set(posts => [ { title => 'Post 01', ... }, { title => 'Post 02', ... }, { title => 'Post 03', ... }, ... ]); print $context->get('posts.0.title'); # Post 01
Renders the template. Returns a XML::LibXML::jQuery object containing the XML::LibXML::Document node.
print $context->render(\%data)->as_html;
Copyright (C) Carlos Fernando Avila Gratz.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Carlos Fernando Avila Gratz <cafe@kreato.com.br>
To install Plift, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plift
CPAN shell
perl -MCPAN -e shell install Plift
For more information on module installation, please visit the detailed CPAN module installation guide.