Re: Mod Perl 2.0 HTTP Handlers
On Sun 02 Nov 2008, Puneet Lakhina wrote:[color=blue]
> One more question, is it possible for me to ensure that my module/or
> essenially mod_perl's processing of the URI translation happens
> before mod_rewrite or any other similar modules, and essentially
> mod_rewrite's rules work on the URI modified by me.[/color]
That order is defined by the 4th parameter to ap_hook_translate_name().
mod_rewrite calls it as:
ap_hook_translate_name(hook_uri2file, NULL, NULL, APR_HOOK_FIRST);
and mod_perl as:
ap_hook_trans(modperl_trans_handler, NULL, NULL, APR_HOOK_REALLY_FIRST);
APR_HOOK_FIRST and APR_HOOK_REALLY_FIRST are integer numbers. Hence, you
can write APR_HOOK_REALLY_FIRST-42 or so.
The actual definitions can be found in
/** run this hook first, before ANYTHING */
#define APR_HOOK_REALLY_FIRST (-10)
/** run this hook first */
#define APR_HOOK_FIRST 0
/** run this hook somewhere */
#define APR_HOOK_MIDDLE 10
/** run this hook after every other hook which is defined*/
#define APR_HOOK_LAST 20
/** run this hook last, after EVERYTHING */
#define APR_HOOK_REALLY_LAST 30
So, a PerlTransHandler is always called before the mod_rewrite
translation handler since APR_HOOK_REALLY_FIRST is less than
APR_HOOK_FIRST. The only way to change that is to patch and recompile
one of the modules.
Need professional mod_perl support?
Just hire me: [email]email@example.com[/email]