[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: PerlSendHeader
From:       fdc () cliwe ! ping ! de (Frank D !  Cringle)
Date:       2000-04-29 14:31:53
[Download RAW message or body]

"Benjamin Reed" <ranger@befunk.com> writes:
> I've turned off PerlSendHeader, but no matter what I do, it seems that I'm
> already getting headers before I ever print anything.

If you turn PerlSendHeader off, you are responsible for sending the
headers yourself.  In the Apache API, and mod_perl's incarnation of
it, sending the headers is achieved by calling $r->send_http_header,
after having set the header values using calls such as
$r->content_type("text/html").  Read 'perldoc Apache' to see all the
stuff that you can put into the headers in this way.

With PerlSendHeader on, mod_perl emulates mod_cgi by slurping up the
initial non-blank lines from your output and doing the above for you,
behind the scenes.

> I have the following in my httpd.conf:
> 
> ---(snip!)---
> Alias /perl/ /home/httpd/perl/
> <Location /perl>
>  SetHandler perl-script
>  PerlHandler Apache::Registry
>  PerlSendHeader Off
>  Options Indexes ExecCGI
> </Location>
> ---(snip!)---
> 
> If I have a script called /home/httpd/perl/index.pl with only the following:
> 
> ---(snip!)---
> $|++;
> print <<END;
> Content-type: text/html
> 
> Hi.
> END
> ---(snip!)---

That should be

use Apache;
my $r = Apache::Request;
$r->content_type('text/html');
$r->send_http_header;
$r->print('Hi.');


-- 
Frank Cringle,      fdc@cliwe.ping.de
voice: (+49 2304) 467101; fax: 943357

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic