I'd like to pass a Template an array of hash values and access each set in a loop.
The following test shows what we'd like to be able to do with Template but I'm
not sure it can be done
$html= Template->new() || die $html->error;
#
# Here is a hash of values
#
%hash = { 'key' => "one",
'value' => "two",
};
#
# Here we have an array of hash values. This example has really been dumbed
down to make it simple
#
for ($i=0; $i <=6; $i++) {
push (@list,%hash);
}
$vars = { ( List => \...@list,
) };
$html->process("test.tmpl",$vars) || die $html->error;
-------------------------------------------------------------------------------------------------
Here is the Template file
-------------------------------------------------------------------------------------------------
Size of list is [% List.size %]
[% FOREACH item IN List -%]
[%# How do we reference one entry in the array? %]
key is [% item.key -%]<br>
value is [% item.value -%]<br>
[% END -%]
Also List.size returns 14 as the size and not 7 like I'd expect
--------------------------------------------------------------------------------
Doug Poulin
Medinet Vancouver
604 742-8845 (direct)
604 742-8850 (fax)
www.medi.net <<logo_tag_120x33.gif>>
_______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
