Gossamer Forum
Home : General : Perl Programming :

Premature end of script headers

Quote Reply
Premature end of script headers
Hi,

I hope somebody can help me.....
I wrote a script which works fine from the command line but when I execute it thru my browser I get a "Premature end of script headers" error. When I use perl -w it shows no weird things and perl -c gives "syntax ok"

Any ideas what I'm doing wrong?

Bye

Qasem
Quote Reply
Re: Premature end of script headers In reply to
print "Content-type: text/html \n\n";

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Premature end of script headers In reply to
Note the '\n\n' You need to have a blank LINE after the content headers. The first \n starts a new line, the second \n makes that newline blank.

It's an easy thing to over look -- and if your script runs ok from the shell, that is probably the problem. Although... this usually generates a '500 server error' rather than a premature end of scripts....

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Premature end of script headers In reply to
Do you have print "Content-type: text/html\n\n"; before you print text or html

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)