[Templates] constructing named parameters for subroutines

[prev] [thread] [next] [Date index for 2004/05/17]

From: Matthias.Dillier
Subject: [Templates] constructing named parameters for subroutines
Date: 14:25 on 17 May 2004




Hi all

I have a TT-variable with a reference to a subroutine. The subroutine takes
a hashreference as parameter. In the referenced hash, there are the 'named'
parameters the subroutine needs. I can call the routine in the
TemplateToolkit like:
[%
value1=1
value2="xxx"
test = mysubroutine(param1 => value1, param2 => value2)
%]

The problem is now, that I don't know the number of the named parameters in
advance. I would like to construct the list of the parameterpairs within a
FOREACH-loop, save this parameters into a variable and then call the
subroutine with this parameters, I constructed in the loop.

Any idea how this can be done?

Thank you for your help. Kind Regards
Matthias Dillier


This message is for information purposes only. It may not be secure or
error-free. The Swiss National Bank does not accept legal responsibility for
any consequences resulting from e-mail use.

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] constructing named parameters for subroutines
Matthias.Dillier 14:25 on 17 May 2004

Re: [Templates] constructing named parameters for subroutines
merlyn (Randal L. Schwartz) 14:55 on 17 May 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52