in reply to cgi theory

Content-type needs to be printed because you may want to output things other than text/html. You could also do application/pdf or image/jpeg.

Apache needs that blank line because it has no good way of otherwise knowing when you're done printing headers and want to send the actual content. There could be more headers to send other than Content-type.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: cgi theory
by cyril (Acolyte) on Sep 15, 2003 at 20:57 UTC
    thanks for the reply

    It does make sense really, I think its just a case of PHP making things easy for the developer rather than exposing more of the realities of how things are put together. PHP much automatically generate the blank line if no additional headers are added by the programmer.


    cyril
      Cyril

      PHP does a good job of hiding much of the mechanics from the programmer, which is one reason it is so popular. But it doesn't take long before you realise that in fact it hides too much. All too often PHP has only one way to do it! Instead of the Perl way - Their is ALWAYS more than one way to do it.

      Perl, with its seemingly endless variety of modules will give you so many more ways to do things, it will give you so much flexibility that it can be rather frightening. In fact it will offer you so many choices as to be totally confusing. Sometimes when asked what Perl has that PHP doesn't the reply is 'CPAN'. Many years of dedicated work by some great computing minds.

      If you are writing CGI scripts then make sure you search here in the monastery and read some of the tutorials and responses addressing various aspects of that subject, they are a veritable gold-mine.

      jdtoronto