Changeset 12490
- Timestamp:
- 05/27/08 02:09:49 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/tiarra/branches/module-reload/main/ModuleManager.pm
r12403 r12490 10 10 use warnings; 11 11 use UNIVERSAL; 12 use Scalar::Util qw(refaddr );12 use Scalar::Util qw(refaddr weaken); 13 13 use Tiarra::SharedMixin qw(shared shared_manager); 14 14 use Tiarra::ShorthandConfMixin; … … 29 29 my ($class, $runloop) = @_; 30 30 croak 'runloop is not specified!' unless defined $runloop; 31 weaken($runloop); 31 32 my $obj = { 32 33 runloop => $runloop, … … 166 167 $modname = ref($modname) || $modname; 167 168 168 push @{$this->{mod_disposables}->{$modname}}, @disposables; 169 my ($foo); 170 push @{$this->{mod_disposables}->{$modname}}, 171 map { $foo = \$_; weaken($_); $foo } @disposables; 169 172 170 173 $this; … … 178 181 return unless $this->{mod_disposables}->{$modname}; 179 182 183 my $arr = $this->{mod_disposables}->{$modname}; 184 @$arr = grep { defined $$_ } @$arr; 185 180 186 my %targets = map { refaddr($_) => 1 } @disposables; 181 @{$this->{mod_disposables}->{$modname}} = 182 grep { !$targets{refaddr($_)} } @{$this->{mod_disposables}->{$modname}}; 187 @$arr = grep { !$targets{refaddr($$_)} } @$arr; 188 189 if (!@$arr) { 190 delete $this->{mod_disposables}->{$modname}; 191 } 183 192 184 193 $this; … … 196 205 foreach my $object (@$arr) { 197 206 eval { 198 $ object->module_destruct($module);207 $$object->module_destruct($module); 199 208 }; if ($@) { 200 209 $this->_runloop->notify_error($@);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)