in reply to Re: Unwanted appearance of "Content-type..."
in thread Unwanted appearance of "Content-type..."

matija, awesome, thanks. Went with your first bullet point:
if ( $newcookie ) { print $query->header(-cookie=>$newcookie,-type=>'text/html'); } else { print "Content-type: text/html\n\n"; } print $template->output();
and it worked perfectly. And thanks for the explanation as well. Looks like I need to do some more reading about HTTP protocols.

—Brad
"A little yeast leavens the whole dough."

Replies are listed 'Best First'.
Re: Re: Re: Unwanted appearance of "Content-type..."
by BUU (Prior) on May 03, 2004 at 22:36 UTC
    That issue has nothing to do with the HTTP, it is just that you didn't read the documentation for CGI::header() closely enough. CGI::header() prints *all* the headers for a typical page, including content type.
      Point well taken BUU. I did just that and for anyone watching, the CGI doc on CPAN says:
      Normally the first thing you will do in any CGI script is print out an HTTP header. This tells the browser what type of document to expect, and gives other optional information, such as the language, expiration date, and whether to cache the document. The header can also be manipulated for special purposes, such as server push and pay per view pages.
      print $query->header(-type=>'image/gif', -nph=>1, -status=>'402 Payment required', -expires=>'+3d', -cookie=>$cookie, -charset=>'utf-7', -attachment=>'foo.gif', -Cost=>'$2.00');<div class="pmsig">
      And I am a better monk for it. Thanks.

      —Brad
      "A little yeast leavens the whole dough."
        And I am a better monk for it.
        Hopefully, it remains to be seen (we'll have to wait for your future questions).