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

Wise men, I have created a series of forms which are generated using CGI and enable people to input data. I want to effectively protect these using an authentication mechanism. Standard HTTP authentication wont do since there is no way to logout individuals and thus, I have resulted to using a simple cookie based mechanism. What is the best way of doing this? Writing the code to read/write and validate cookies myself seems very error-prone but unfortunately I have not located any modules on CPAN (apart from Catalyst or mod_perlrelated ones) for doing so. Is there no module without requiring a framework or mod_perl to do something like this? Thank you edit: CGI Session was the way to go - thank you.

Replies are listed 'Best First'.
Re: authentication via cookies
by moritz (Cardinal) on Oct 29, 2009 at 10:19 UTC
    I usually use CGI::Session for that.
    Perl 6 - links to (nearly) everything that is Perl 6.
Re: authentication via cookies
by scorpio17 (Canon) on Oct 29, 2009 at 13:04 UTC
    I agree that CGI::Session is the way to go - but please note that ideally all you should store in the cookie is the session ID - all other data will be stored server-side (in a file, in a database, etc.).
Re: authentication via cookies
by sierpinski (Chaplain) on Oct 29, 2009 at 12:42 UTC
    One thing that I used to do before my birth in the Perl realm was to use type=hidden form tags to pass data from one page to another. This included a session ID, username, basically any information that you needed each page to have. It could get messy, but it was very easy to construct.

    That being said, and not having looked at it myself, CGI::Session sounds right up your alley!
    /\ Sierpinski