[Templates] Why can't I create a list of named hashes?

[prev] [thread] [next] [Date index for 2004/11/18]

From: Jason Peck
Subject: [Templates] Why can't I create a list of named hashes?
Date: 18:08 on 18 Nov 2004
Can someone help me figure out how to create a named hash, then include
it in a named list within a template? I can't understand why the
following does not work:

[% 
       mod_menu =
       {
          title=> "Title",
          html=> "Html text"
       }
 
       right_modules = [
          $mod_menu
       ]

%]

[% FOREACH module = right_modules %]
      [% module.title %]
      [% module.html %]
[% END %]  


It produces an error:
! undef error - Template::Stash::XS: get (arg 2) must be a scalar or
listref


I also tried using \$mod_menu. In that case, I don't get an error but
nothing is printed.




        -- 
        Jason Peck

Focus Robotics
Tel. 603.594.3097
http://www.focusrobotics.com


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Why can't I create a list of named hashes?
Jason Peck 18:08 on 18 Nov 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52