我无法执行CGI中的HTML :: Template功能。使用HTML :: Template模块的问题
我下面一个简单的教程,我发现在这里:http://metacpan.org/pod/HTML::Template
我我在家里路径test.tmpl服务器上创建一个新文件。
我创建了一个名为frt.cgi一个新的文件...(是这里的问题?它应该是一个不同的文件扩展??)
#!/usr/local/bin/perl -w
use HTML::Template;
# open the html template
my $template = HTML::Template->new(filename => '/test.html');
# fill in some parameters
$template->param(HOME => $ENV{HOME});
$template->param(PATH => $ENV{PATH});
# send the obligatory Content-Type and print the template output
print "Content-Type: text/html\n\n", $template->output;
我已经修改了一号线反映我的主机提供的perl程序路径。我不知道-w是什么,我只是知道我已经尝试过,没有它。此外,我已经尝试改变代码有点像这样:
use warnings;
use strict;
use CGI qw(:standard);
use HTML::Template;
我搜索...
https://stackoverflow.com/search?q=HTML%3A%3ATEMPLATE+&submit=search
https://stackoverflow.com/search?q=HTML%3A%3ATEMPLATE
https://stackoverflow.com/search?q=HTML%3A%3ATEMPLATE+PERL&submit=search
但我仍然没有看到回答。 我甚至在谷歌搜索.TMPL编码,因为我认为可能需要一些特殊类型。请帮忙。
.tmpl文件只是文本文件。 -w只是打开警告。这相当于'使用警告;'如果您发布了错误消息,这将有所帮助。你确定安装了HTML :: Template吗?这不是一个标准模块。 – Cfreak
@Cfreak [不完全等同](http://perldoc.perl.org/perllexwarn.html)。 – melpomene