Re: How to write a macro that changes a scalar variable
"Kiss Gabor (Bitman)" <kissg-8/[email protected]> Tue, 21 Oct 2014 21:15:59 +0200 (CEST)
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
> You can return a scalar (but not an array or hash ref) in > the macro's output, and capture it in a variable using SET. > > > $ tpage > [% MACRO seven BLOCK; "7"; END %] > ! starting... > [% SET var = 3 %] > ! var before = [% var %] > [% SET var = seven() %] > ! var after = [% var %] (wanted 7 here) > [%####################################%] > > ! starting... > > ! var before = 3 > > ! var after = 7 (wanted 7 here) Cooool! :-) Many thanks. Gabor