MVC::Neaf::View::TT - Template toolkit-based view module for Neaf.
# Somewhere in your app return { -view => 'TT', -template => 'foo.tt', title => 'Page title', .... }; # Neaf knows it's time to render foo.tt with returned data as stash # and return result to user # What actually happens my $view = MVC::Neaf::View::TT->new; my $content = $view->render( { ... } ); # And if in foo.tt <title>[% title %]</title> # Then in $content it becomes <title>Page title</title>
This module is one of core rendering engines of MVC::Neaf known under TT alias.
TT
See also neaf view.
neaf view
%options may include:
template - default template to use.
preserve_dash - don't strip dashed options. Useful for debugging.
preload => { name => 'in-memory template' } - preload some templates. See preload() below.
preload()
INCLUDE_PATH => [path, ...] - will be calculated relative to the calling file, if not starts with a '/'.
Also any UPPERCASE OPTIONS will be forwarded to the backend (i.e. Template object) w/o changes.
Any extra options except those above will cause an exception.
Returns a pair of values: ($content, $content_type).
Content-type defaults to text/html.
The template is determined from (1) -template in data (2) template in new(). If neither is present, empty string and "text/plain" are returned.
Store precompiled templates under given names.
Returns self, dies on error.
Template - the template toolkit used as backend.
This module is part of MVC::Neaf suite.
Copyright 2016-2023 Konstantin S. Uvarin khedin@cpan.org.
khedin@cpan.org
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MVC::Neaf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MVC::Neaf
CPAN shell
perl -MCPAN -e shell install MVC::Neaf
For more information on module installation, please visit the detailed CPAN module installation guide.