I recently had to create a website with user log-in and log-out etc and decided to Do It Properly and use CGI::Session instead of hacking my own stuff together.

However, I'm a bit puzzled by a few things:

  1. Why is the CGI::Session::Cookbook no longer visible on the distribution page? It has one major error in it (arguments the wrong way around in the call to the init() sub) but on the other hand, it has a 'recipe' which exactly what I need for the user log-in situation. Has it become obsolete or deprecated in some way? I just used the suggested methods with version 4.13 of the module and everything seems fine.
  2. Why is the current release labelled "UNAUTHORISED" in big red letters? That's a bit scary. Is there some kind of dispute between authors?
  3. I can't find any reference in the pod or the Cookbook to a "remember me" session, i.e. the classic checkbox on a log-in form which means you don't have to log in next time. I solved this myself by inventing my own session param and putting:
    if($session->param('_REMEMBER')){ # set cookie with long expiry }else{ # set default cookie which expires on browser close }
    but I was surprised to see that the idea doesn't even come up. Is this just a matter of fashions changing, and the "remember me" checkbox not being much used when the module was first written?
  4. Although there's a driver for saving sessions in a MySQL database, I was a bit surprised to find it just creates an entry with the session id as the primary key and a long string of text with everything else. It's hardly better than the default text-file method. You might as well use dbmopen() or a tied hash. I know you can create your own params, meaning the table would need to change, because I just did so, but surely it would be much more useful to create a proper table with all the vars in their own column? And if I need to tweak the object by adding my own params then I should be smart enough to add my own column?


Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

In reply to Some questions about CGI::Session by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.