Thanks for the link, this is a starting point. Yes, I'm using mod_perl. The reason I asked this is that I have a PHP application that authenticates via a MySQL database (a table with usernames and encrypted passwords). PHP does pretty good WWW Authentication, you can get at the supplied parameters via $PHP_AUTH_USER and $PHP_AUTH_PW (after sending a 401 header).
I already tried to use Apache::AuthDBI, but the problem is that the passwords in the database are MySQL-encrypted, and Apache::AuthDBI prefers plain text or crypt(8) passwords. Bad luck. But with that Apache->request stuff I think it can be done. I'll give it a try.