From f5a6d16466fd528171002a137440e9d99eb9129a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 2 Oct 2012 17:33:57 -0500 Subject: implement ../ --- lib/Text/Handlebars.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/Text/Handlebars.pm') diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index aa239a0..c58ae86 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -4,6 +4,8 @@ use warnings; use base 'Text::Xslate'; +use Scalar::Util 'weaken'; + sub default_functions { my $class = shift; return { @@ -35,7 +37,11 @@ sub default_functions { die "invalid value: $value" if !defined($ref) || $ref ne 'HASH'; - return $value; + weaken(my $vars_copy = $vars); + return { + %$value, + '..' => $vars_copy, + }; } else { return $vars; -- cgit v1.2.3-54-g00ecf