Hi all,

I found that if I explicitly undef %session, CLEAR will be triggered 
before DESTROY clearing $self->{data}, so $self->save actually update 
nothing in the database.

  # Apache/Session.pm
  ...
  sub CLEAR {
    warn "CLEAR!\n";
  ...
  sub DESTROY {
    warn "DESTROY!\n";
  ...

  # The script
  ...
  tie %session, 'Apache::Session::Oracle', undef, {
    ...,
    Commit => 1,
  };
  $session{array_ref} = [ 1..10 ];
  print "Storing session to database...\n";
  undef %session;  # Nothing stored

When executed, it gives

  bash$ perl test.pl
  Storing session to database...
  CLEAR!
  DESTROY!

Then I use SQLPlus to find in the database, the record is there, but 
it only contains the serialized form of { _session_id => xxx }, which is 
inserted by tie().

Can anyone explain this to me?

Thanks,
Kenneth

Reply via email to