我通过cpan安装了Perl模块HTML :: Template。 Perl本身识别模板模块,但是当我尝试作为一个Perl CGI脚本使用,它会触发下列错误:PERL Web开发:找不到Perl模块,但已安装
$ cat /var/log/httpd/error_log
[Tue Feb 14 11:28:27 2012] [error] [client 127.0.0.1] Can't locate HTML/Template.pm in @INC (@INC contains: /root/perl5/lib/perjl5/ /usr/local/lib/perl5 /usr/$
[Tue Feb 14 11:28:27 2012] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at /var/www/cgi-bin/index.pl line 4.
[Tue Feb 14 11:28:27 2012] [error] [client 127.0.0.1] Premature end of script headers: index.pl
我的Perl脚本(index.pl)情况如下:
#!/usr/bin/perl -w
use lib "/root/perl5/lib/perjl5"; # is it the correct way to include libs?
use HTML::Template; # error line
print "Content-type: text/html\r\n\r\n";
print "Hello there!<br />\nJust testing .<br />\n";
for ($i=0; $i<10; $i++)
{
print $i."<br />";
}
如果我加载脚本http://localhost/cgi-bin/index.pl它会重新调用500内部服务器错误。
将模块安装和位于:/root/perl5/lib/perl5/HTML/Template.pm
逸岸$的perldoc perllocal回报:
[...]
[1mMon Feb 13 16:43:34 2012: "Module" HTML::Template[0m
· "installed into: /root/perl5/lib/perl5"
· "LINKTYPE: dynamic"
· "VERSION: 2.6"
· "EXE_FILES: "
[...]
它是正确installe? 如果键入: $ perl的-e “使用HTML ::模板”没有错误返回
Im'using的Fedora 16
Linux version 3.2.5-3.fc16.i686 ([email protected]) (gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)) #1 SMP Thu Feb 9 02:24:08 UTC 2012
感谢您的帮助。