From bb3ff3e1f924d530b3bfdf192849b5ac1b9aa5b2 Mon Sep 17 00:00:00 2001 From: "mascip (Pierre Masci)" Date: Mon, 9 Dec 2013 13:22:21 +0000 Subject: template_params dependency, to send parameters to the template --- lib/OX/View/TT.pm | 30 ++++++++-- t/array_parameter.t | 92 +++++++++++++++++++++++++++++++ t/data/array_parameter/templates/index.tt | 8 +++ 3 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 t/array_parameter.t create mode 100644 t/data/array_parameter/templates/index.tt diff --git a/lib/OX/View/TT.pm b/lib/OX/View/TT.pm index 5e11579..9f8697e 100644 --- a/lib/OX/View/TT.pm +++ b/lib/OX/View/TT.pm @@ -10,17 +10,28 @@ use Template; 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'], + dependencies => ['template_root', 'template_params'], ); =head1 DESCRIPTION This is a very thin wrapper around L