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

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

  • Comment on Re: Re: Re: CGI.pm, CGI::Session and Cookies

Replies are listed 'Best First'.
Re: CGI.pm, CGI::Session and Cookies
by digger (Friar) on Feb 09, 2004 at 22:30 UTC
    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
      Now under Windoze I cannot help you. There shouldn't be anything major, I have a suspicion I have used this with Apache on Windows - but not recently - we don't use any Windows as servers any more.

      Write some test code to see if you can do a $session->flush, and a $session->close. The try re-opening the session again. If you can re-open it and you can retrieve the data you stored in it, then it is all working but it is simply a matter of where the file is to be found!

      The author, Sherzod Ruzmetov, does maintain a website at http://author.handalak.com and he usually answers email.

      jdtoronto

        I wanted to follow up and let you know what I finally found out. There were a couple of issues.
        • I had to install CGI::Session in my local lib, and a couple of the files appeared to be truncated during the upload. I re-uploaded the files, and finally got an informative error message.
        • Only one specific directory is writeable in the hosting environment; this is not documented anywhere. When I called support, they told me they didn't even have perl/cgi available on Windows hosting. I had to point the support person to their own docs online to show otherwise. When I put the session files in the correct directory, everything worked like magic.
        Thanks again for your valuable tips.
        digger