in reply to Perl and htaccess

Cosmicperl,
two points:

1. Apache features
Basic and/or digest authentication - afaik, there is no way how to change browser behavior when auth credentials requested by Apache. Additionally, there is no way how to command browser to forgot used credentials (log out).

2. Proprietary features
it is possible and relatively easy to do, but it depends on your application framework (I mean modperl || php || cgi || ...). I can imagine mod_perl PerlHandler, which is the first in the handler chain, and which checks some cookie containing session ID.
If unsatisfied, prints the html login page and AVOIDS next handler in the chain to process.
If unsatisfied but login and password sent, checks it against rdbms or file, creates unique session id and sets related cookie.
If satisfied, does nothing special, just leaves processing to the next handler of the chain.
Update: I have such handler somewhere, so, let me know if you (or somebody else) are interested in...