OX::View::TT - View wrapper class for TT renderers
version 0.02
package MyApp; use OX; has 'template_params' => ( block => sub { my $s = shift; return { some_scalar => 'value', some_array => ['one', 'two'], }; }, ); has view => ( is => 'ro', isa => 'OX::View::TT', dependencies => ['template_root', 'template_params'], );
This is a very thin wrapper around Template which exposes some OX functionality to your template files. It can be passed a template_params dependency, containing variables that will be passed to the template. Templates rendered with this class will have access to these additional variables:
base
The base URL that this app is hosted at (SCRIPT_NAME).
SCRIPT_NAME
uri_for
A function which forwards its arguments to the uri_for method in OX::Request.
m
The hashref of match variables for the current route (equivalent to the mapping method on the OX::Request object).
mapping
render($r, $template, $params)
Renders a template, and returns a string containing the contents. $r is the request object, $template is the name of the template, and $params are extra variables to pass to the template.
$r
$template
$params
template($r)
This is an action method which can be used directly as a route endpoint:
route '/about' => 'view.template', ( template => 'about.tt', );
No known bugs.
Please report any bugs to GitHub Issues at https://github.com/doy/ox-view-tt/issues.
OX
You can find this documentation for this module with the perldoc command.
perldoc OX::View::TT
You can also look for information at:
MetaCPAN
https://metacpan.org/release/OX-View-TT
Github
https://github.com/doy/ox-view-tt
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=OX-View-TT
CPAN Ratings
http://cpanratings.perl.org/d/OX-View-TT
Jesse Luehrs <doy@tozt.net>
This software is Copyright (c) 2014 by Jesse Luehrs.
This is free software, licensed under:
The MIT (X11) License
To install OX::View::TT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OX::View::TT
CPAN shell
perl -MCPAN -e shell install OX::View::TT
For more information on module installation, please visit the detailed CPAN module installation guide.