I am trying to print a XML file in the browser using a perl script. While I am trying to run the script in my browser I am having the following error.
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
Here is my script.I checked the syntax too, using a syntax checker. No problem with my perl configuration, since other simple perl scripts are working fine. I think the problem will be with the "use CGI;" Guide me..
#!/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!! I just ranamed the file,then tried..its working!!!! What was the real problem?