Async-Blackboard
view release on metacpan or search on metacpan
lib/Async/Blackboard.pm view on Meta::CPAN
# values in a single method invocation, it has to check the value of
# hangup before every dispatch for hangup to work properly.
unless ($self->hungup) {
$self->{-objects}->{$key} = $found{$key};
$self->_found($key);
}
}
}
=item weaken KEY
Weaken the reference to KEY.
When the value placed on the blackboard should *not* have a strong reference
(for instance, a circular reference to the blackboard), use this method to
weaken the value reference to the value associated with the key.
=cut
sub weaken {
my ($self, $key) = @_;
Scalar::Util::weaken $self->{-objects}->{$key};
}
=item delete KEY [, KEY ...]
Given a list of keys, remove them from the blackboard. This method should be
used with I<caution>, since watchers are not notified that the values are
removed but they will be re-notified when a new value is provided.
=cut
t/03_memory_leaks.t view on Meta::CPAN
$blackboard->hungup or die "Blackboard was hung up";
$blackboard->hangup;
}
{
my $blackboard = Async::Blackboard->new();
$blackboard->put(blackboard => $blackboard);
$blackboard->weaken("blackboard");
}
}
=item Watcher in loop
Run most of the tests from t/01_watcher.t in a loop (not using the actual test
harness, that proved too problematic) some 20 times and verify that the
resident footprint and number of tracked objects did not change.
=cut
( run in 0.282 second using v1.01-cache-2.11-cpan-65fba6d93b7 )