Hi Marcel,

I think you have misunderstand what H::T is used for -> you put data into the template, not pull data out.

In this case, DEFAULT is used when you put in VAR1, and it happens to be undef.

cheers,
Mathew Robertson

On 18 November 2011 03:59, Marcel van Dorp <marcel@van-dorp.nl> wrote:
Hi list,

I'm new here, so please be kind.

I would like to retrieve the default value from the template, eg.

TMPL_VAR NAME="VAR1" DEFAULT="DEFAULTVALUE1"

I would like to process this value, but

my $value = $tpl->param('VAR1');

does not give me the value "DEFAULTVALUE1"

I cannot find another way to get the value eg: $tpl->query


Basically I would like to write a sub, which retrieves an LDAP filter
from the template, and fills the template with the values retrieved. The
TMPL_VAR name should be the same as the attribute name. With multiple
value attributes you will need a TMPL_LOOP (otherwise you only get the
first value).

This would greatly simplify my code, as I fill lots of templates with
different LDAP filters.

(as a sidenote: this should not be too difficult to extend to SQL
queries as well).

I can achieve this with hidden form fields, but I do not want or need
the info in the (HTML) output. Also I will lose the scoping of the
variables, which is in fact very convenient.


Another approach is to add eg. TMPL_PARAM, but I am not that good a
programmer that I can extend a module like HTML::Template

Can anyone help?


Marcel

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users