in reply to Webserver level authentication?

If you are happy hand rolling but want to do this at the web server level then investigate PerlTransHandler's these can be used to impliment global pre-processing in modPerl.

Example :- http://perl.apache.org/start/tips/favicon.html

Hope this Helps
UnderMine