On Mon, 9 Apr 2012 20:28:14 +0200
Manfred Lotz <manfred.l...@arcor.de> 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. 
> 
> Is this possible?
> 
> 

When I'm asking if this is possible I mean if there is a Toolkit option
for the desired behavior. 

Of coure, I could check it by myself:
     $str =~ m/ \[ \% \s+ (?:[^\s]+) \s+  \% \] /x 
        and die "Not all variables could be substituted!\n"; 


-- 
Manfred




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to