in reply to Structuring multiple CGI::Application modules II

I think you've got your design backwards. You're trying to go to the home page first. Generally, the steps are:
  1. User goes to the website.
  2. User is presented with a login page.
  3. User enters credentials (username/password, generally).
  4. User hits submit.
  5. Server validates credentials
    1. If invalid, server re-sends login page with useful-ish error message
    2. If valid, server sends home page. Server also sets cookie to indicate user has logged in successfully
  6. All other pages check for existence of cookie. If cookie isn't there, redirect to login page.

This means that your cookie-checking method is in the base class. Your pages are in the child classes. cgiapp_prerun() will call your cookie-checking method to determine if it should redirect to the login page or not. The runmode method won't even be executed unless the cookie is there and has been verified.

Generally, one has one C::A child to do logging in, logging out, password changes, etc. Then, you have a few other C::A children that do actual content generation. So, you'd actually have two CGI scripts - one for login and one for show_survey. Both would inherit from your baseclass.

We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested