summaryrefslogtreecommitdiffstats
path: root/lib/Text/Handlebars.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Text/Handlebars.pm')
-rw-r--r--lib/Text/Handlebars.pm8
1 files changed, 7 insertions, 1 deletions
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;