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, 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';