I've been using the Template module for quite a while now and have had no problems, I can figure out most things on my own. In fact, this is the first time I'm unable to solve this by myself and it's frustrating me :). I've got the following array (with real data, not typed numbers) and am passing it to Template as shown.:
my $options = [ qw(one two three) ]; $TMPL->process('somewhere.tmpl', { myopts => $options } );
Okay, so that part is trivial. Now, within the template (somewhere.tmpl in the example), I am using a [% PROCESS another.tmpl %]. Now, this other template is expecting an array of hashes in a variable called 'options'. Each one of the options needs to be passed along in the 'value' key of the hash. Since that probably doesn't make much sense in words, here's some perl pseudo-code for what I need to accomplish in TT syntax:
[% PROCESS "another.tmpl" options = [ map { {value => $_} } myopts ] %]
I've checked the TT docs and I can't find a map() within TT. There is a grep virtual method, but no map. How do I go about passing this barrier? It's proving to be more difficult to me than you'd think! I thank thee brother or sister ahead of time for your wonderful wisdom.
In reply to Juggling structures with Template Toolkit by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |