This is a small part of code from a larger script, but is the main part. I get the same err msg (Can’t call method “output” on an undefined value) in a browser and from the shell command line (Can’t call method “output” on an undefined value at ./temp.cgi line 11.). I know Text::FastTemplate is working in general b/c it works on all my PHP scripts. Just this one Perl script it does not like for some reason. Running Perl 5.8.8 on centos.
Suggestions?
#!/usr/bin/perl
use Text::FastTemplate;
$templatedir = '/home/virtual/site/data/cgi-templates';
$filename = 'customer.tpl.html';
print "Content-type: text/html\
\
";
$template = new Text::FastTemplate(file=>$filename, path=>$templatedir);
print $template->output(); [I]<-- the line giving the err msg[/I]
exit;
Man, can’t believe something so simple took so long to find. It was the actual template files causing the prob. They had an #include to old non-existent template footer file.
Text::FastTemplate->new() is returning an undefined value.
Probably due to it not liking something in the constructor, I’d check to make sure the files are readable, and whether it’s using some sort of cache directory that isn’t accessible? (One would have to inspect Text/FastTemplate.pm, tracing through ‘new’ to see what it’s doing, or, maybe look in the docs for some kind of error variable)