On Mon, 2002-04-01 at 23:31, [EMAIL PROTECTED] wrote:
>
> I'm fairly new at Perl and the use of the Template toolkit.
>
> I'm not getting the results I would expect with INTERPOLATE => 1. I would
> expect to be able to reference $variables in my template file. Below is my
> program, template file and output.
>
> With INTERPOLATE => 1 all I see is blanks where my values for $name and
> $dummy should be. Not working !!!!
>
> With INTERPOLATE => 0 the output simply prints Name = $name and dummy
> = $dummy. This is what I would expect.
Even though you have INTERPOLATE set, you still need to pass the data in
so the template can see it:
> #--------------------------------- program ------------------------------
> #!/usr/local/bin/perl
>
> use Template;
>
> $name = "Joe Blo";
>
> $dummy = 6;
>
> print "Date = $date, Dummy = $dummy\n";
>
> my $tt = Template -> new ({
> INTERPOLATE => 1,
> INCLUDE_PATH => '/export/home/prod/tomw'
> }) || die "$Template::ERROR\n";
>
> my %data1 = (tester => 'CAT-33', report => 'BCM lot');
Change this to:
my %data1 = (tester => 'CAT-33', report => 'BCM lot',
name => $name, dummy => $dummy );
and see what happens.
Chris
--
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.