j3 has asked for the wisdom of the Perl Monks concerning the following question:

When creating a site that requires a user to login to gain access, so far it seems to me that there's 2 common ways to set it up:

  1. Use Apache's Basic authentication (using htpasswd, and .htaccess and .htpasswd files -- and even Apache::Htpasswd).
  2. Use something like CGI::Session along with cookies (CGI::Cookie).

If your site doesn't require anything persistent beyond just remembering that the user is logged in, what are the reasons for choosing one of the above methods over the other?

I understand that, as soon as you start needing some persistent state (like, keeping track of a user's shopping cart), then you need to go with something like option 2... But, are there circumstances where you'd use both of the above options together?