Hi.

You can use

PerlAuthenhandler Your::Module->special

See http://perl.apache.org/docs/2.0/user/coding/coding.html#Techniques



Cédric Bertolini wrote:
@Michel,

Thanks for the reply. As far as I know, Apache2::RequestRec is a module that
provides several functions to manage the $request object provided by
mod_perl (http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html). It's
not really a handler, though most handlers use this module one way or
another. I just want to use a different handler than usual, but from the
same file, If that's possible.

@Nico

Thanks for the reply. Deciding on a behavior based on $r->uri or
$r->filename in the handler is what I was doing previously, but I'd love to
have a solution based the config file instead of the handler itself, for
robustness. I will have to stick to this solution if mod_perl doesn't let me
provide the name of the handler, though.



2010/9/27 Nico Coetzee <nicc...@gmail.com>

I had a similar requirement. My solution: based on the value of $r->uri() I
would call the different subs from the main handler() sub. All the other
subs take $r as the first argument and then the rest of the parameters
follow.

Probably not the best solution, but it worked for me.

Cheers

Nico

2010/9/27 Cédric Bertolini <bertolini.ced...@gmail.com>

Hello,
I apologize for such a trivial question, but I'd like to use a function
other than "handler" as a perl handler. According to the doc, it was
possible in mod_perl 1, but I can't manage to get it to work under mod_perl
2.


Here is an example of my code:

file Authen.pm

sub handler {
  // regular handling
}

sub special {
  // special case
}
file httpd.conf

<Location /perl/>
   PerlAuthenHandler  /lib/Authen
</Location>
<Location /perl/special-case/>
  # I want to override the regular case by using "special" instead of
"handler" in /lib/Authen.pm
</Location>
Thanks in advance,
Cédric Bertolini




Reply via email to