in reply to Sending a cookie header and HTML output

You should send just one header section. Like this:
use CGI; . . . print header(-type=>'text/html', -cookie=>$your_cookie ...)
So once more - just one header section but with multiple information inside it.

Update: added the word 'section' to be more prcecise - inspired by tfc22.

Replies are listed 'Best First'.
Re: Re: Sending a cookie header and HTML output
by Anonymous Monk on Jun 24, 2003 at 13:54 UTC

    Just to clarify:

    print header(-cookie => $cookie); ... print header(-type => 'text/html');

    Then printing the HTML won't work?

      It won't. To see why just capture the output of executing the program to a file. The header according to HTTP specification is only the text untill the first blank line (or every character until two consecutive new lines). You'll see that this program would output a blank line between parts of what should be the header.

        Ah yes, hence the two newlines when sending a plain Content-Type header. Thanks for the explanation :)