作者shane123 (家产有八十七亿  ﰩ
看板perl
标题请帮我看看我的cgi有没有写错??
时间Sat Dec 4 20:28:42 2004
#!/usr/local/bin/perl
use lib "$home/xxx";
use CGI;
use strict;
use Template;
my $q=new CGI;
print $q->header(-charset => 'utf-8');
print $q->start_html("hello");
my $config=
{
INCLUDE_PATH => ".",
eval_perl =>1,
};
my $template=Template->new($config);
my $replace="Hello你好阿!!";
my $vars=
{
var =>$replace,
};
my $temp_file="template.htm";
my $output="";
$template->process($temp_file,$vars,$output) or die $template->error();
print $output;
print $q->end_html();
以下是template.htm的档案
仔细看喔[% var %]
那个pl的档案在console下都可以正常执行
不过拿来当做cgi就会出现500的错误
请问到底错在哪里呢??
谢谢~
(ps. 别的perl程式都可以正常执行
所以应该不是权限等等设定错误~~)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.62.97.25
1F:推 synth:你有 "Content-type..." 吗?! 221.169.96.188 12/04
2F:推 shane123:print $q->header(); 就会自动输出啦 61.62.97.25 12/05
3F:推 henrynet:最後加个"1;"看看 140.116.131.114 12/10
4F:推 shane123:ok...我试试看~~ 61.62.97.25 12/10