Hello,

I have problem accessing complex perl data structures from TT. Let's say
i have following data:

%rec = (
  42 => {
    name => 'category name',
    story => [
      { id => 15, topic => 'story 1' },
      { id => 16, topic => 'story 2' },
    ],
  },
  44 => {
    name => 'category name 2',
    story => [
      { id => 17, topic => 'story 3' },
      { id => 19, topic => 'story 4' },
    ],
  },
);

If i try to print out 'name's from TT doing this:
[% FOREACH foo = rec %]
   [% foo.name %]
[% END %]

then nothing, no output at all :(. Now if I try to print out [%
foo.keys.${0} %] then output is 'key' and ${1} is 'value', why's that? 

If i try it without FOREACH loop like this:

[% rec.42.name %] then i can see correct name, which is 'category name'.

And almost same story goes for 'story'. I can't access it from FOREACH
loop :(. Any help is appreciated.

Rgds,
Viljo


Reply via email to