Dear folks,

How could I define a macro that modifies a scalar variable
got in param list?

This obviously does not work:

/tmp$ cat macrotest
[% MACRO seven(param) BLOCK %]
 [% SET param = '7' %]
! var inside = [% var %] param inside = [% param %]
[% END %]
! starting...
[% SET var = 3 %]
! var before = [% var %]
[% seven(var) %]
! var after = [% var %] (wanted 7 here)
/tmp$ tpage macrotest 

! starting...

! var before = 3

 
! var inside = 3 param inside = 7

! var after = 3 (wanted 7 here)
/tmp$ 


I do understand what happens but I have no idea how to modify
the code. Actually I would need a macro that acts like a subroutine
and returns a scalar value but I guess this is not possible.
Therefore I tried to modify named parameters but they seems to be
localised too.

Any hint? (Except usage of Perl subroutines.)

Thanks

Gabor

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to