Hello List,
my $template = HTML::Template->new(filename => 'my.tmpl');
When 'my.tmpl' is not found, the cgi script dies with following message
in the error_log:
HTML::Template->new() : Cannot open included file
/var/www/html/nkDir/my.tmpl : file not found. at
/usr/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 1580
HTML::Template::_init_template('HTML::Template=HASH(0x809dbe8)') called
at /usr/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 1177
HTML::Template::_init('HTML::Template=HASH(0x809dbe8)') called at
/usr/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 1071
main::showHome('HASH(0x804b5a4)', 'HASH(0x854f3b0)', '') called at
/var/www/cgi-bin/nkDir/home.cgi line 71
[Sat Jul 10 08:12:59 2004] [error] [client 127.0.0.1] Premature end of
script headers: /var/www/cgi-bin/nkDir/home.cgi
I would like to catch this error and do a graceful exit by displaying
"'my.tmpl' not found!" message back to user.
One way I can think of is to 'stat my.tmpl' before calling new(), but
just wanted to check if there are better ways.
Thanks
Nishi
|