[Templates] Hash referencen in passed in variables
[prev]
[thread]
[next]
[Date index for 2004/08/30]
Forgive me if this has been answered previously or sounds
like a newbie type of questions (which I am when it comes
to TT2) but I'm having difficulty processing hashes and
arrays that are passed in as variables to the template
processor.
In my template handler I have the following code:
my %hash = { var1 => "foo", var2 => "bar" };
my $vars = { myhash => \%hash };
$TT->proecess("/template.tt2", $vars);
And /template.tt2 access the myhash in the following way:
[% FOREACH item IN myhash %]
The item is [% item %].
[% END %]
When this gets processed, however, nothing is printed out;
no items, not even "The item is .". I have also noticed
this behavior with arrays. I cannot see that I am doing
anything immediately wrong, and the Template documentation
(eg. perldoc Template) intimates that this is an acceptable
construct. What do I need to do to get the hash reference
working the way I expect it to?
I am using Template-Toolkit 2.13 and mod_perl 1.99.
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
[Templates] Hash referencen in passed in variables
Steven Bergom 18:02 on 30 Aug 2004
|