我想在瀏覽器中使用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