I am having a strange problem, maybe something to do with Apache more than Perl. In my code when I write:
print "content-type: text/html\n\n";
it prints that along with the code. But when I type:
$c = new CGI; $c->header();
it works fine and displays the HTML rendered output.
What could the problem be?
Keep in mind, HTTP RFC specifies that
is used for line delimiters, not
so you want to be emitting
print "Content-Type: text/html\r\n\r\n";
You should just use
->headers though to do this for you.
Also, note I used Camel-Case instead of lower-case. Although both should work, the Camel-Case is the notation used in the spec, so that is preferred and more likely to work on weird UA's.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki