http://qs321.pair.com?node_id=682054

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

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 ...