perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <>
Subject Re: $r->status() ?
Date Sat, 01 May 2004 13:41:13 GMT

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.



Report problems:
Mail list info:
List etiquette:

View raw message