How can I track down "Template process failed: undef error" in Perl's Template Toolkit?
Posted
by swisstony
on Stack Overflow
See other posts from Stack Overflow
or by swisstony
Published on 2010-05-04T15:03:21Z
Indexed on
2010/05/04
21:38 UTC
Read the original article
Hit count: 380
I've moved a Perl CGI app from one web host to another. Everything's running fine except for Template Tookit which is giving the following error:
"Template process failed: undef error - This shouldn't happen at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 314."
The templates are working fine on the other web host. I've set the DEBUG_ALL flag when creating the template object, but it doesn't provide any additional info about errors just loads of debug output.
I can't post the template source as there's lots of client specific stuff in it.
I've written a simple test template and that works okay. Just wondering if anyone had seen this error before or has any ideas on the quickest way to find a fix for it.
EDIT: Here's a snippet of the code that loads and processes the template.
my $vars = {};
$vars->{page_url} = $page_url;
$vars->{info} = $info;
$vars->{is_valid} = 0;
$vars->{invalid_input} = 0;
$vars->{is_warnings} = 0;
$vars->{is_invalid_price} = 0;
$vars->{output_from_proc} = $proc_output;
...
my $file = 'clientTemplate.html';
#create ref to hash
use Template::Constants qw( :debug );
my $template = Template->new(
{
DEBUG => DEBUG_SERVICE | DEBUG_CONTEXT | DEBUG_PROVIDER | DEBUG_PLUGINS | DEBUG_FILTERS | DEBUG_PARSER | DEBUG_DIRS,
EVAL_PERL => 1,
INCLUDE_PATH => [
'/home/perlstuff/templates',
],
}
);
$template->process( $file, $vars )
|| die "Template process failed: ", $template->error(), "\n";
© Stack Overflow or respective owner