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.
$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]
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.
This script worked perfectly before changing to a new server.
Tried the example. Exact same err msg.
Haven't used FastTemplate myself but the documentation says that "path" needs to be an array ref.
This is a list of directories to be searched when a file is specified with a relative pathname. The list of paths is passed in an ARRAY-REF.
$template = new Text::FastTemplate(file=>$filename, path=> [ $templatedir ]);
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)
Have a look in $! (not always useful)
Catching up four days late ....... and only a tip for the future ...
Didn't see any use strict; use warnings; in your code excerpt.
They are both useful when trying to isolate a problem.