Johannes Kilian asks:
> I'm quite new to Template, but I encountered a problem I don't understand?
> ----------------------
> use Template;
>
> my $test;
> $test->{'vars'}->{'component'}->{'name'}='test';
> $test->{'vars'}->{'dir'}->{'documentation'}='D:/temp';
>
> my $str='[% dir.documentation %]/[% component.name %]';
>
> my $tt = Template->new({ INTERPOLATE => 1, })|| die "ERROR!!\n";
> my $retstr;
> $tt->process(\$str, $test->{'vars'}, \$retstr)|| die "ERROR!!\n";
>
> print $retstr;
> ------------------------------
>
> What I expected to get as $retstr:
> D:/temp/test
>
> What i really got as $retstr:
> D:/temp/input text
>
> What's wrong there? (ActivdePerl 5.8.4, Template 2.14)
'component' is, like e.g. 'template', a special variable to TT, and it
happens to have an element called "name". You can't override this.
There's a section "Special Variables" in the TT manual (Section
"Variables") listing all of them.
You get "D:/temp" because that's the value of dir.documentation.
You get "/" becaues that's a constant.
You get "input text" because that's what the builtin variable
component.name holds this value if the template
is a scalar ref.
One easy solution would be to just rename 'component' to 'comp' in
your code.
--
HTH,
haj
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates