Hi,

I'm going to try and make a switch from PHP to Perl for my next web project. I've just been going through the basics and was wondering why there is the need to output an HTTP header line as the first line of output from a perl script. I run apache and it seems that a certain level of intelligence takes place before passing the data back to the client because Apache seems to cut out any duplicate HTTP headers, that is to say it appears that the ouput from Perl is not just added to the headers and sent without first being checked. For example, if the first line of my Perl output is to simply output "\r\n", that works fine and a content-type header is added automatically by Apache as I would expect. If I output a Content-Type header in Perl, Apache doesn't then try and add this header twice. Therefore, I would have though that it would be simple enough for Apache to add the extra line break needed before sending back the data. I am hoping someone can help me understand how it is all formed as It always helps me to know why things behave how they do. Hope that made some sense.


regards

cyril


In reply to cgi theory by cyril

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.