summaryrefslogtreecommitdiffstats
path: root/lib/OX/View/TT.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/OX/View/TT.pm')
-rw-r--r--lib/OX/View/TT.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/OX/View/TT.pm b/lib/OX/View/TT.pm
index 8383754..0390231 100644
--- a/lib/OX/View/TT.pm
+++ b/lib/OX/View/TT.pm
@@ -42,23 +42,25 @@ sub normalize_web_base {
$base;
}
-sub render {
- my ($self, $r, $template, $params) = @_;
-
+sub build_template_params {
+ my ($self, $r, $params) = @_;
my $BASE = $self->normalize_web_base( $r );
+ return +{
+ r => $r,
+ base => $BASE,
+ uri_for => sub { $BASE . $r->router->uri_for( %{ $_[0] } ) },
+ %{ $params || {} }
+ }
+}
+sub render {
+ my ($self, $r, $template, $params) = @_;
my $out = '';
$self->tt->process(
$template,
- {
- r => $r,
- base => $BASE,
- uri_for => sub { $BASE . $r->router->uri_for( %{ $_[0] } ) },
- %{ $params || {} }
- },
+ $self->build_template_params( $r, $params ),
\$out
) || confess $self->tt->error;
-
$out;
}