summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStevan Little <stevan.little@iinteractive.com>2010-01-15 12:04:23 -0500
committerStevan Little <stevan.little@iinteractive.com>2010-01-15 12:04:23 -0500
commit634718a49213ecb47a3e84eae6884ad5845d8035 (patch)
tree2c6b03d469be689692cb059a45be2893d24c5fd0
parent0495d476055c9e0fe414f373fffd6d058b3d4c17 (diff)
downloadox-view-tt-634718a49213ecb47a3e84eae6884ad5845d8035.tar.gz
ox-view-tt-634718a49213ecb47a3e84eae6884ad5845d8035.zip
rough cut of the Nib
-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;
}