diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-02 17:33:57 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-02 17:33:57 -0500 |
commit | f5a6d16466fd528171002a137440e9d99eb9129a (patch) | |
tree | 5c19fc0674a2f2a0a4cfec7641f9da7f1a87d6cf /lib/Text/Handlebars.pm | |
parent | 5f753f44ba7f37c744f46f8c0334c70a05f8281b (diff) | |
download | text-handlebars-f5a6d16466fd528171002a137440e9d99eb9129a.tar.gz text-handlebars-f5a6d16466fd528171002a137440e9d99eb9129a.zip |
implement ../
Diffstat (limited to 'lib/Text/Handlebars.pm')
-rw-r--r-- | lib/Text/Handlebars.pm | 8 |
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; |