mod-auth-external is useful when you need to provide http basic auth , but authorise from an external program and not an htpasswd file.
The installation and configuration outlined at the wiki worked for me. I was on Ubuntu 11.04 , so httpd was replaced by apache2 and apxs was apxs2. There is an example perl script in the source code here.
Here is my ruby version of it:
This is almost what I used later on: