in reply to Malformed Header Error

You need to print out some headers before the page content.
print "Content-type: text/html\n\n";
or even better
print header(-type => 'text/html');
Boris

Replies are listed 'Best First'.
Re^2: Malformed Header Error
by macPerl (Beadle) on Jul 19, 2004 at 17:09 UTC
    Thanks for responding - but, having tested, that is not the solution. I was (am?) under the impression that the Document Type Declaration
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML .01//EN" "http://www.w3.org/TR/html4/loose.dtd">
    superseded the header
    Content-type: text/html.

    No ? Note, I generally use the "Strict DTD" but left in "loose" in this test in order to rule out that possibility.
      No, you need a content-type header. the header need to send out, before the content.
      #!/usr/bin/perl use CGI qw(:standard); use strict; sub printpage(); print header( -type => 'text/html'); printpage(); exit;
      Boris
        Boris, Joost,

        thanks for the help and patience. I had overlooked this in the HTML 4.01 spec. I guess the servers/user agents I've been using have been too forgiving !

        Regards,

        mP.
      No.DOCTYPE declarations are ADDITIONAL to the content-type. If you set content-type to "text/plain" for instance, the browser should ignore any markup in the file and just show it as plain text with funny tags in it.

      You need a valid content-type header. Sometimes this is automatically provided by the webserver, but most of the time, it isn't.

      Also, you might have uploaded your perl script as binary with different line-endings than the line-endings on the target machine, or your script is not executable by the webserver user (do chmod 755 filename).

        Ouch - this is embarrassing ...

        I have recently started using LeechFTP which has no options on what the line-endings are.

        To check the line-endings (also initially suggested by ccn) I did the upload via the command prompt and that has resolved the problem.

        Thank you all very much for your time and expertise.