>>>>> "Thomas" == Thomas Falgout <[EMAIL PROTECTED]> writes:

Thomas> Instead of substituting a blank, how can I get $template->process() to
Thomas> give me an error if there's any variables that aren't defined? I know
Thomas> that I shouldn't have any missing variables, but I'm developing the
Thomas> interface and someone else is developing the templates.  Sometimes
Thomas> there's missing info.  I'd like to be able to find out when I've
Thomas> missed something, rather than Templates blindly putting in blank vars.

You might be able to subclass Template::Stash and override ->get so that it
yells if an undef value is returned.

    package My::Stash;
    use base qw(Template::Stash);

    sub get {
      my $self = shift;
      my $value = SUPER::get(@_); # get original value
      die "stash got @_ as undef" unless defined $value;
      return $value;
    }

    $Template::Config::STASH = __PACKAGE__; # use me, not that

    1;

Then say "use My::Stash" before "use Template".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to