diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-18 13:50:24 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-18 13:50:24 -0500 |
commit | aeaebb1f5210808a2dd97bba9054ef0c007f208e (patch) | |
tree | 48a713f46bfafdce3f0f8545340b95f51f7ad619 /lib/Text/Handlebars.pm | |
parent | 89749c72af405d0ec10c6003d2c86872042c1f77 (diff) | |
download | text-handlebars-aeaebb1f5210808a2dd97bba9054ef0c007f208e.tar.gz text-handlebars-aeaebb1f5210808a2dd97bba9054ef0c007f208e.zip |
reimplement new_vars_for in terms of merge_hash
Diffstat (limited to 'lib/Text/Handlebars.pm')
-rw-r--r-- | lib/Text/Handlebars.pm | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index 154a78b..787ac22 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -124,26 +124,9 @@ sub default_functions { return { %{ $class->SUPER::default_functions(@_) }, %{ $class->default_helpers }, - '(new_vars_for)' => sub { - my ($vars, $value, $i) = @_; - - if (ref($value) eq 'ARRAY') { - $value = ref($value->[$i]) eq 'HASH' - ? { '.' => $value->[$i], %{ $value->[$i] } } - : { '.' => $value->[$i] }; - } - - if (ref($value) eq 'HASH') { - return { - '@index' => $i, - %$vars, - %$value, - '..' => $vars, - }; - } - else { - return $vars; - } + '(merge_hash)' => sub { + my ($left, $right) = @_; + return { %$left, %$right }; }, }; } |