You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Kenneth Lee <ke...@alfacomtech.com> on 2000/07/20 18:31:21 UTC

Apache::Session - expected behaviour?

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
  ...
  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;  # Clears $self->{data}

Gives,

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

Is this the expected bebaviour that one should not explcitly undef 
the tied hash?

Regards,
Kenneth