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::Setting;
=cut
use strict;
use Scalar::Util qw(weaken);
=head1 NAME
@ -67,21 +68,6 @@ sub add {
$self->set(@_);
}
#-------------------------------------------------------------------
=head2 DESTROY ( )
Deconstructor.
=cut
sub DESTROY {
my $self = shift;
undef $self;
}
#-------------------------------------------------------------------
=head2 get ( $param )
@ -145,8 +131,10 @@ A reference to the current WebGUI::Session.
sub new {
my $class = shift;
my $session = shift;
my $settings = $session->db->buildHashRef("select * from settings", [], {noOrder => 1});
bless {_settings=>$settings, _session=>$session}, $class;
my $self = bless { _session => $session }, $class;
weaken $self->{_session};
$self->{_settings} = $session->db->buildHashRef("select * from settings", [], {noOrder => 1});
return $self;
}