classes under session should weaken their session references

This commit is contained in:
Graham Knop 2010-04-16 19:29:18 -05:00
parent 241c94175f
commit 2b78fe913b
17 changed files with 81 additions and 248 deletions

View file

@ -15,6 +15,7 @@ package WebGUI::Session::Var;
=cut
use strict;
use Scalar::Util qw(weaken);
=head1 NAME
@ -46,19 +47,6 @@ These methods are available from this package:
=cut
#-------------------------------------------------------------------
=head2 DESTROY ( )
Deconstructor.
=cut
sub DESTROY {
my $self = shift;
}
#-------------------------------------------------------------------
=head2 end ( )
@ -75,7 +63,6 @@ sub end {
$session->scratch->deleteAll;
$session->db->write("delete from userSession where sessionId=?",[$id]);
delete $session->{_user};
$self->DESTROY;
}
#-------------------------------------------------------------------
@ -171,7 +158,8 @@ normally be used by anyone.
sub new {
my ($class, $session, $sessionId, $noFuss) = @_;
my $self = bless {_session=>$session}, $class;
my $self = bless { _session => $session }, $class;
weaken $self->{_session};
if ($sessionId eq "") { ##New session
$self->start(1);
}