Hello,

This seems be a rather basic problem but I haven't
found the solution in the last several hours and have
run out of ideas.  I am using MP2 with Apache::Session
1.80.  I have created a session object class so I can
keep the retrieving of the session out of my main
code.  The session is called started/retrieved in a
constructor:

sub new {
  my $this = shift;
  my $class_name = ref($this) || $this;   
  my $sid = shift;            # should be undef if not
passed

  # create a session object based on the cookie we got
from the
  # browser, or a new session if we got no cookie
  my %session;
  tie %session, 'Apache::Session::MySQL', $sid, {
    Handle => $_dbh,
    LockHandle => $_dbh
  };

  $session{'stuff'} = 'is this in the database?';

  my $objRef = {'sid' => $session{_session_id}, 
       'session' => \%session };  # create references
to object
  bless $objRef, $class_name;     # associate
reference with class

  return $objRef;
}
Note that I set 'stuff' immediately after the session
is created.  I would expect at this point that the
database be updated. 

Then I use subroutines to add and retrieve data from
the session. 

The session is inserted into the sessions table, but
the a_session is never updated.  I tried using the
tied( %session )->make_modified, and I tried untie(
%session ) when I am done with the request, but none
of those seem to cause anything to be written in the
database.

Here is the table definition:

mysql> describe sessions;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default |
Extra |
+-----------+-------------+------+-----+---------+-------+
| id        | varchar(32) |      | PRI |         |    
  |
| a_session | text        | YES  |     | NULL    |    
  |
+-----------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Any one have any ideas?  

much appreciatively,

greanie

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to