我想在浏览器中使用perl脚本打印XML文件。虽然我试图在浏览器中运行脚本,但遇到以下错误。Perl脚本不工作..(错误:脚本标题提前结束)
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: get_data.pl
If you think this is a server error, please contact the webmaster.
Error 500
localhost
01/15/10 14:29:28
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1
这是我的script.I检查语法也使用语法检查器。我的Perl配置没问题,因为其他简单的Perl脚本工作正常。我认为问题将出现在“使用CGI”上。指导我..
#!/usr/local/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $r = new CGI();
my $id = $r->param('id');
if(!defined($id))
{
print "Content-type: text/html\n\nMissing parameter: id\n";
exit 1;
}
if($id eq '7007')
{
print "Content-Type: text/xml\n\n";
open INPUT, "get_data.xml";
while(<INPUT>) {
print $_; }
close INPUT;
}
OMG !!我只是给这个文件命名,然后尝试了。 真正的问题是什么?
将文件重命名为什么?我们没有ESP! – 2010-01-16 16:59:26