in reply to CGI.pm, CGI::Session and Cookies

You are tantalisingly close - here is how it should be!
my $session_cookie = $q->cookie( -name => 'CGISESSID', -value => $sess->id, );
CGI::Session is expecting the cookie name to be CGISESSID. You are naming the cookie something else. Don't put anything else in the cookie, just the session-id and that will be fine. Of course you need to set the expiry values and the domain.

Then once you have the session you can save the other things in the session, not the cookie. ,P. jdtoronto

Replies are listed 'Best First'.
Re: Re: CGI.pm, CGI::Session and Cookies
by digger (Friar) on Feb 09, 2004 at 21:06 UTC
    If I could ++ you triple, I would. I can't believe I misunderstood the docs so completely. Thanks for pointing out my obvious problem.

    digger
      Thank you, digger, but it is such an easy thing to do! I remember when I first tried working with CGI::Session, it took me days to get a grasp of it. The documentation is good, but is not always easily understood.

      jdtoronto

        Now that I'm getting the cookie, and the session info, I can move forward a little bit.

        Now I am not getting any files in the directory I created for the session data. I changed my session initialization line to my $session = new CGI::Session("driver:File", $q, {Directory=>"c:\\path\\to\\sessions\\"}); to use the actual Windows file path to my directory. I have tried a few permutations to this, like  {Directory=>'../sessions/'}, but still don't get my session files. Again, I get no errors, and all the dependencies appear to be in place and relatively up to date. Is there an issue with using the file driver under Windows? Or did I miss something obvious again?

        Thanks again for your insight,
        digger