This appendix acts as a mini-cookbook for mod_perl. As
we've mentioned many times in this book, the
mod_perl mailing list is a terrific resource for anyone working with
mod_perl. Many very useful code snippets and neat techniques have
been posted to the mod_perl mailing list. In this appendix, we
present the techniques that you will find most useful in your
day-to-day mod_perl programming.
A.1. Emulating the Authentication Mechanism
You can authenticate users with your
own mechanism (instead
of the standard one) but still make Apache think that the user was
authenticated by the standard mechanism. Set the username with:
$r->connection->user('username');
Now you can use this information, for example, during logging, so
that you can have your "username"
passed as if it was transmitted to Apache through HTTP
authentication.