On Tue, 21 Oct 2014 11:27:31 +0200 (CEST)
"Kiss Gabor (Bitman)" <ki...@ssg.ki.iif.hu> wrote:

> 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.

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)


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to