|P is for Practical|
CGI::Session keeps re-using same session IDby alain_desilets (Beadle)
|on May 01, 2012 at 17:45 UTC||Need Help??|
alain_desilets has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to implement a simple login dialog for my application, and am having trouble making it work.
Below is a small piece of code that illustrates my problem:
This script displays a 'login' and a 'stay logged' links. The 'login' link is supposed to create a brand new session (line 21), by invoking new CGI::Session::new() and passing it an undefined value for the CGI argument. The 'stay logged' link is supposed to create a session using the current session ID (line 24), by passing an actual CGI instance as the second argument of CGI::Session::new().
But it doesn't work!
If I click multiple times on the 'login' dialog, I see the same session id being used over and over again. Same goes for the 'stay logged' link, but that one is to be expected.
Note that I am running under mod_cgi (NOT mod_perl), and that it can't be a cache issue, because the URL of each of the invocations of the script is different (because I add a different random cgi argument to it everytime).
What am I doing wrong? Thx.