diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-03 11:49:18 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-03 11:49:18 -0500 |
commit | dd17e9001091ce49528625ee46e2d0bc73423a7f (patch) | |
tree | 44503d0334792b0b72b7f0b9adcd8534e3f0f4e3 /lib/Text/Handlebars.pm | |
parent | 3875faa18e63d4bf5336b07279fc36f306900972 (diff) | |
download | text-handlebars-dd17e9001091ce49528625ee46e2d0bc73423a7f.tar.gz text-handlebars-dd17e9001091ce49528625ee46e2d0bc73423a7f.zip |
'.' should be a variable name referring to the current array element
Diffstat (limited to 'lib/Text/Handlebars.pm')
-rw-r--r-- | lib/Text/Handlebars.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index 836e253..30a769c 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -30,8 +30,12 @@ sub default_functions { if (defined $ref && $ref eq 'ARRAY') { die "no iterator cycle provided?" unless defined $i; - $value = $value->[$i]; - $ref = ref($value); + + $value = ref($value->[$i]) + ? $value->[$i] + : { '.' => $value->[$i] }; + + $ref = ref($value); } return $vars unless $ref && $ref eq 'HASH'; |