in reply to Structuring multiple CGI::Application modules II
- User goes to the website.
- User is presented with a login page.
- User enters credentials (username/password, generally).
- User hits submit.
- Server validates credentials
- If invalid, server re-sends login page with useful-ish error message
- If valid, server sends home page. Server also sets cookie to indicate user has logged in successfully
- 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