automatically send http header

Discussion in 'Perl Misc' started by Alex Shi, Feb 9, 2004.

  1. Alex Shi

    Alex Shi Guest

    With php you don't need to explicitly send http header before
    print or echo. However in perl you need it. Even with mod_perl
    you have to issue following before any http output

    print "Content-type: text/plain\n\n";

    I am just wondering if it possible to add a command in Apache
    configuration so that we don't need the line of sending header
    in perl script?

    Thanks in advance!

    Alex Shi


    --
    ==================================================
    Cell Phone Batteries at 30-50%+ off retail prices!
    http://www.pocellular.com
    ==================================================
     
    Alex Shi, Feb 9, 2004
    #1
    1. Advertising

  2. Alex Shi

    Matt Garrish Guest

    "Alex Shi" <> wrote in message
    news:slUVb.17465$...
    > With php you don't need to explicitly send http header before
    > print or echo. However in perl you need it.
    >


    Perl is an all-purpose scripting language, so of course you have to send
    your own header. Output goes to STDOUT. If STDOUT happens to be going to a
    browser, you have to format your http headers accordingly. It wouldn't make
    for a very good language if every time you tried to print to STDOUT an http
    header was dumped out (Perl != CGI).

    >
    > I am just wondering if it possible to add a command in Apache
    > configuration so that we don't need the line of sending header
    > in perl script?
    >


    You're asking an apache configuration question in a Perl newsgroup. Someone
    here might have an answer for you, but you're far more likely to get a
    response by posting your question to a newsgroup that deals with apache
    configuration issues. There's no harm in trying here (depending on who
    responds), but I suspect most people will just ask you what your Perl
    question is.

    Matt
     
    Matt Garrish, Feb 9, 2004
    #2
    1. Advertising

  3. "Alex Shi" <> wrote in news:slUVb.17465$L34.8842@nntp-
    post.primus.ca:

    > With php you don't need to explicitly send http header before
    > print or echo. However in perl you need it. Even with mod_perl
    > you have to issue following before any http output
    >
    > print "Content-type: text/plain\n\n";
    >
    > I am just wondering if it possible to add a command in Apache
    > configuration so that we don't need the line of sending header
    > in perl script?


    You do realize that the content type depends on the type of the content you
    want to send, right?

    Sinan.


    --
    A. Sinan Unur
    (reverse each component for email address)
     
    A. Sinan Unur, Feb 9, 2004
    #3
  4. [Tuesday 10 February 2004 00:06]Alex Shi () wrote:

    > With php you don't need to explicitly send http header before
    > print or echo. However in perl you need it. Even with mod_perl
    > you have to issue following before any http output
    >
    > print "Content-type: text/plain\n\n";
    >
    > I am just wondering if it possible to add a command in Apache
    > configuration so that we don't need the line of sending header
    > in perl script?
    >
    > Thanks in advance!
    >
    > Alex Shi
    >
    >


    I think this can be achieved by using CGI.pm
     
    Thomas Deschepper, Feb 11, 2004
    #4
  5. Alex Shi

    J. Gleixner Guest


    > [Tuesday 10 February 2004 00:06]Alex Shi () wrote:
    >
    >
    >>With php you don't need to explicitly send http header before
    >>print or echo. However in perl you need it. Even with mod_perl
    >>you have to issue following before any http output
    >>
    >>print "Content-type: text/plain\n\n";
    >>
    >>I am just wondering if it possible to add a command in Apache
    >>configuration so that we don't need the line of sending header
    >>in perl script?



    And your perl question is??? (Hint: You're posting this question to the
    wrong group.)

    The answer: Yes. Read the mod_perl documentation:
    http://perl.apache.org/docs/2.0/user/config/config.html
     
    J. Gleixner, Feb 11, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mike
    Replies:
    5
    Views:
    973
    Keith M. Corbett
    Sep 21, 2004
  2. Vivek Mehta
    Replies:
    3
    Views:
    8,690
    Vivek Mehta
    Aug 12, 2004
  3. mlt
    Replies:
    2
    Views:
    854
    Jean-Marc Bourguet
    Jan 31, 2009
  4. Kamal Ahmed
    Replies:
    1
    Views:
    151
    Elton Wang
    Jun 22, 2005
  5. Nacho Nachev
    Replies:
    2
    Views:
    909
Loading...

Share This Page