I'm trying to explore using sessions in my application. It seems that my option is restricted to Apache::Session. Please let me know if other session modules exist for my platform.

My test codes are as follows:
First run (to generate the session):

   my %session;
   eval
   {
       tie %session, 'Apache::Session::File', undef,
           {Directory => 'd:/sessions',
           LockDirectory   => 'd:/LockSessions',};
   };
   if ($@)
   {
       die "Global data is not accessible: $@";
   }
   print $session{_session_id};
    undef %session;

Subsequent runs:

   my %session;
   my $SessionID = 'c2e9a96e10b6918c4a358591413cddf5';
   eval
   {
       tie %session, 'Apache::Session::File', $SessionID,
           {Directory => 'd:/trendicate3/sessions',
           LockDirectory   => 'd:/trendicate3/LockSessions',};
   };
   if ($@)
   {
       die "Global data is not accessible: $@";
   }
   print $session{name}.'<br>';
   $session{name} = 'John Doe';
    undef %session;

My problems as as follows:
1. For some strange reason, the page will not load completely. What I mean to say is that the page displays, but the connection will not end, as if the process (thread, in Windows implementation) cannot end. I suspect maybe cleaning up the tie() has something to do with it. 2. I tried to store some stuff in the session (see code above), but it did not store. Very strange. I suspect if I can solve (1), (2) will resolve on its own.

Hope you guys can point me in the right direction. Thanks.

Reply via email to