martin langhoff wrote:
> 
> hi,
> 
>         I've been developing with mod_perl for a while, but, thanks to
> Richter's Embperl module and the excellent backwards compatibility
> (regarding CGI.pm) I had never got anywhere near Apache::Request -- for
> production, that is.
> 
>         Now I have this very silly question, that I've boiled down to this
> little snippet of code (which carries a remakable resemblance to the
> example found in page 146 of the Eagle Book):
> ----------------------
> #!/usr/bin/perl -w
> use strict;
> use Apache::Constants qw(:common);
> 
> my $r = Apache->request;
> $r->content_type('text/html');
> $r->send_http_header;
> 
> return OK unless $r->header_only; # THIS is the line I'm wondering about
> 
> $r->print(<<END);
> <html><body><h1> Hello ! </h1>
> <address> martin</address></body></html>
> END
> 1;
> 
> ------------------------
> 
>         The issue is that I don't understand clearly what is this line supposed
> to do. As it is, it'll make my script return an empty body ('document
> contains no data!' said Navigator). Commented out, the proper contents
> are sent. Reading the Eagle and `man Apache::Request` led me to thing
> that the line is there to stop processing if all the client wants are
> the headers (maybe because of a 'If-Modified-Since' parameter?).

I believe all you need to add is "return OK;" after your print
statement. Without that, Apache doesn't know what the status of the
request should be.

-- 
Drew Taylor
Software Engineer
Phone: 617.351.0245
Fax 617.350.3496
OpenAir.com - Making Business a Breeze!
Open a free account today at www.openair.com

Reply via email to