Sorry, but no. The ability to create anonymous arrays in situ is a special case that the TT parser handles. You cannot work with them, as in normal Perl, without the intermediate step of assigning a named variable.
EDIT: You cannot even execute a routine to try to use it like this:
[% FOREACH month IN my_reverse([1..12]) %] [% month %] [% END %]
Also you cannot use a method for an object:
[% FOREACH month IN testObj.my_reverse([1..12]) %] [% month %] [% END %]
They will compile, but in each case the FOREACH construct sees the head of the chain, for example. a CODE in the first case and a blissful object in the second.
Adam bellaire
source share