Re: status() vs constants - modperl

This is a discussion on Re: status() vs constants - modperl ; > Now, in my handler sub I want to return the corresponding constant for whatever
> status() is set to. Under mod_perl 1.x this worked by just returning the
> status() since OK == 200, SERVER_ERROR == 500,
OK is ...

Re: status() vs constants

> Now, in my handler sub I want to return the corresponding constant for whatever
> status() is set to. Under mod_perl 1.x this worked by just returning the
> status() since OK == 200, SERVER_ERROR == 500,

OK is not 200. OK is 0, HTTP_OK is 200. 'tis always been this way
> etc. But this isn't true under
> mod_perl 2 (as far as I can tell).

mp1 assumed that if you returned 200 (HTTP_OK) you really meant 0 (OK).
this is no longer true with mp1. if you do the right thing (return OK,
not HTTP_OK) then both mp1 and mp2 do the right thing.

in general, you should never worry about $r->status - whether you're in
mp1 or mp2, your handler() subroutine should always return either one of
OK, DECLINED, or DONE, or some HTTP _error_ code (like 500, 304, etc).
over in httpd land apache will translate your return value into a
suitable value of $r->status (which isn't always the same as what you
returned, such as when you're in an ErrorDocument it will force
$r->status to whatever the original error status was if your
ErrorDocument returns 500).