Helmut Zeilinger wrote:
> Hi all,
> 
> i am confused about $r->status().
> When do i have to set this "manually" - if ever?

you should never set $r->status from a handler.

> I searched for documentations about this item, but i did not find a
> detailed explaination.

I've explained it on this and the dev list a few times, so you should find
discussions in the archives.  it's also in the mod_perl developer's cookbook.

> 
> My problem is, what's the difference between
> 
> sub handler {
> ..
> $r->status(404);
> return (?);
> }

that idiom is used with Registry scripts and Registry scripts only.  it's
basically a hack that let's Registry scripts return something other than ok.
 note that Registry sets $r->handler back to whatever it was before you
messed with it, and it is the only valid use of $r->status($foo).

> 
> and
> 
> sub handler {
> ..
> return (HTTP_NOT_FOUND);
> }
> 
> [? means that i don't know what to return]

the return value of the handler is the status that gets set on the HTTP
Response Line.  $r->status is really an internal bookeeping variable for
apache - most of the time it's the same as the response line status, but if
you set it manually it will mess up any future error document cycles, since
that's the marker that apache uses for keeping track of recursive errors
(the "additionally, a 500 server error was encountered" foo).

again, you can search the archives and MPDC for more details.

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to