Why not adopt me?
NAME
OX::View::TT - View wrapper class for TT renderers
VERSION
version 0.02
SYNOPSIS
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'],
);
DESCRIPTION
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
). 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).
METHODS
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.
template($r)
This is an action method which can be used directly as a route endpoint:
route '/about' => 'view.template', (
template => 'about.tt',
);
BUGS
No known bugs.
Please report any bugs to GitHub Issues at https://github.com/doy/ox-view-tt/issues.
SEE ALSO
SUPPORT
You can find this documentation for this module with the perldoc command.
perldoc OX::View::TT
You can also look for information at:
MetaCPAN
Github
RT: CPAN's request tracker
CPAN Ratings
AUTHOR
Jesse Luehrs <doy@tozt.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Jesse Luehrs.
This is free software, licensed under:
The MIT (X11) License