[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: The evility of $r->status
From: Geoffrey Young <geoff () modperlcookbook ! org>
Date: 2006-05-19 19:29:01
Message-ID: 446E1C7D.5080504 () modperlcookbook ! org
[Download RAW message or body]
Kjetil Kjernsmo wrote:
> Hi all!
>
> We have a bunch of old scripts that set $r->status explicitly. For
> handlers, that's deprecated and unnecessary, but I understand that was
> the usual way to do it in registry scripts in the old days of mp1.
>
> What is not clear to me is if this is evil for scripts under mp2. We're
> seeing some weird behavior sometimes, and this was under my suspicion,
> but I don't quite know what to do about it (since I usually write
> handlers myself) and I wouldn't want to get into all that old
> code... :-)
>
> So, is the use of $r->status evil for Registry scripts under mp2, and if
> so, what should be done to rewrite them?
it's the same as mp1. note that with both mp1 and mp2, using $r->status
in registry scripts is merely a hack
# handlers shouldn't set $r->status but return it, so we reset the
# status after running it
my $old_status = $self->{REQ}->status;
my $rc = $self->run;
my $new_status = $self->{REQ}->status($old_status);
return ($rc == Apache2::Const::OK && $old_status != $new_status)
? $new_status
: $rc;
so, basically $r->status is used to communicate the registry handler
return code, not really set r->status over in C-land (as it would be if
you called it from a normal handler).
HTH
--Geoff
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic