develooper Front page | perl.beginners | Postings from April 2012

Re: Template::Toolkit question

Thread Previous | Thread Next
From:
Manfred Lotz
Date:
April 9, 2012 20:57
Subject:
Re: Template::Toolkit question
Message ID:
20120410055148.536c865d@arcor.com
On Tue, 10 Apr 2012 01:07:32 +0200
"Jenda Krynicky" <Jenda@Krynicky.cz> wrote:

> > Hi all,
> > Let's say I use Template:Toolkit like this:
> > 
> > <-----------------snip------------------->
> > #! /usr/bin/perl
> > 
> > use strict;
> > use warnings;
> > 
> > use Template;
> > 
> > my $variables = { nrme => "Manfred", };
> > 
> > my $cmd = 'Hi [% name %], how are you.';
> > 
> > my $template = Template->new();
> > 
> > $template->process(\$cmd, $variables)
> >   or die $template->error(), "\n";
> > <-----------------snap------------------->
> > 
> > and accidentally I have a typo in $variables (nrme instead of
> > name). The output is: Hi , how are you.
> > 
> > IMHO, this is really bad. I would like to get an error saying that a
> > variable could not be substituted. 
> 
> Perhaps this? http://search.cpan.org/~abw/Template-Toolkit-
> 2.24/lib/Template/Manual/Config.pod#STRICT

Thanks, this is what I'm looking for. I have Template 2.20 installed
on my system which doesn't have that option. However, I now discovered 
   	DEBUG => 'undef',
which does the same.


-- 
Manfred



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About