I'm playing around with CGI::Session (using MySQL as the driver) and I'm having a problem with the cookie end of things. The session gets created and stores the information into the database, but for some reason, it's not saving a cookie file to my local browsers settings (IE).
In the CGI::Session Tutorial documentation, it says to write a cookie like so:
$cookie = $cgi->cookie(CGISESSID => $session->id);
print $cgi->header( -cookie=>$cookie );
I read somewhere that a cookie won't be written locally unless " -path => '' " isn't set when creating your cookie (read this on another forum, may not be correct). Looking at CGI's documentation, I see that a cookie would be invoked like this:
$cookie = $query->cookie(-name => 'sessionID',
-value => 'xyzzy',
-expires => '+1h',
-path => '/cgi-bin/database',
-domain => '.capricorn.org',
-secure => 1);
print $query->header(-cookie=>$cookie);
How do I work with the CGI object so that I can use CGI::Session and also write the cookie to the browser? I seem to be able to only do one or the other (I can write the cookie, but then my session doesn't seem to work, or I can get the session working, but the cookie doesn't get written).
"My" code is just the examples from the CGI::Session Cookbook at this point - I'm just trying to get it to work.
djw