If I have:
perl -MTemplate -MTemplate::Stash -le
'Template->new({STASH=>Template::Stash->new()})->process(\"Hi. [%
FOREACH key IN x.keys() %]Key [% key %], [% END
%]",{x=>{a=>2,b=>3,keys=>[4,5,6]}});'
...one would think, not being familiar with TT, that “x.keys()” is a
method call.
As many of us know, though, TT looks first at the “keys” item of the “x”
hash.
Even if you do “x.keys(1)”, TT will still treat this as a hash lookup.
It’s not too difficult to teach Template::Stash how to regard the “1”
argument as an explicit request for a method; however, getting it to
treat “.keys()” as a method, when there is a “keys” item in the hash, is
a taller order that appears to require altering Parser.yp.
Has anyone had experience with this? Might there possibly be an RT case
about this already?
-FG
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates