[Israel.pm] mod_perl question: Ending an apache request with an OK status inside a PerlFixupHandler?

Yuval Yaari yuval at windax.com
Wed Apr 28 07:32:54 PDT 2004


I have a site written in mod_perl which handles user's permissions very 
nicely... I really like the way its built:
I have a PerlFixupHandler which checks if the current user has a 
session, if he can view the page type (passed by PerlSetVar) and also 
does some other data validation.
This is great because it keeps all the dirty work outside my 
PerlHandlers and my PerlHandlers are short and clean.
They also recieve parameters by pnotes from the PerlFixupHandler and 
they die() if they can't get them (assuring the PerlFixupHandler runs 
before them...).

Inside the PerlFixupHandler, I returned Apache::Constants::FORBIDDEN(); 
and logged the readon, but I decided to give normal errors.
So I changed all the return lines to call a small subroutine that I 
wrote, that basically opens a template (TT...) and throws the message 
(with "trace" parameters in case it's a my fault [that abovementioned 
PerlSetVar is missing, etc]).
In the end of that subroutine, I return Apache::Constants::OK();

The thing is, that it then goes to the PerlHandler.
I would like the end the request at that point, but still return an OK 
status, and never get to my PerlHandlers.

Please let me know if you know how this could be achieved (or if it 
isn't possible for any reason...).


More information about the Perl mailing list