Hi,

sorry for my "screwed up" previous mail - here's the corrected version:

Johannes

>Hello
>
>I'm just at the beginning of using TT from perl.
>I have the following (probably simple) problem - but I don't see the
>solution:
>---------------
>#!perl
>use Template;
>
>my @array;
>push @array,'entry1';
>push @array,'entry2';
>push @array,'entry3';
>push @array,'entry4';
>
># Test1
>print "\nTEST1:\n";
>my $retstr1;
>my $tt1 = Template->new({ VARIABLES => { version => 3.14,  release =>
>'Sahara', },});
>my $vars = { serial_no => 271828};
>my $templ1 = "This is version [% version %] ([% release %]). - Serial
>number: [% serial_no %]";
>$tt1->process(\$templ1, $vars,\$retstr1);
>print $retstr1."\n";
>
>#----------------------
>#Test2
>print "\nTEST2:\n";
>
>my $retstr2;
>my $templ2 ="[% FOREACH item IN arr %][% item %][% END %]";
>my $tt2 = Template->new()|| die "ERROR!!\n";
>$tt2->process(\$templ2, {arr => [EMAIL PROTECTED], \$retstr2)|| die
>"ERROR!!".$tt2->error()."\n";
>print $retstr2."\n";
>
>#----------------------
>#Test3
>print "\nTEST3:\n";
>my %param;
>my $retstr3;
>my $templ3 ="[% arr.join(\"\n\") %]";
>my $tt3 = Template->new()|| die "ERROR!!\n";
>$param{'arr'[EMAIL PROTECTED];
>$tt3->process(\$templ3, \%param, \$retstr3)|| die
>"ERROR!!".$tt3->error()."\n";
>print $retstr3."\n";
>
>exit;
>---------------
>The first Test of the script is a slightly modified example from the
>TT-docu. - the second and third test are my trials to process array ...
>Test2 and Test3 make the s
>Running this script, I got the following output (while debugging in Komodo):
>---------------
>TEST1:
>Use of uninitialized value in concatenation (.) or string at
>SCALAR(0x200dff8) line 1.
>Use of uninitialized value in concatenation (.) or string at
>SCALAR(0x200dff8) line 1.
>This is version  (). - Serial number: 271828
>
>TEST2:
>template error - line 1: unexpected END directive
>
>******SCRIPT DIES HERE!!!!
>  
>
>
>TEST3:
>Use of uninitialized value in concatenation (.) or string at
>SCALAR(0x200e10c) line 1.
>template error - (no information)
>
>******SCRIPT DIES HERE! (AFTER DEACTIVATING TEST2)
>  
>
>---------------
>
>So what's wrong here?
>  
>
begin:vcard
fn:Johannes Kilian
n:Kilian;Johannes
org:VITRONIC Dr.-Ing. Stein Bildverarbeitungssysteme GmbH;Entwicklung Verkehrstechnik
adr:;;Hasengartenstr. 14;Wiesbaden;Hessen;65189;Germany
email;internet:[EMAIL PROTECTED]
tel;work:+49-[0]611-7152-250
tel;fax:+49-[0]611-7152-133
x-mozilla-html:FALSE
url:http://www.vitronic.com
version:2.1
end:vcard

Reply via email to