App-mirai
view release on metacpan or search on metacpan
lib/App/mirai/Future.pm view on Meta::CPAN
future => $f,
deps => [ ],
type => (exists $f->{subs} ? 'dependent' : 'leaf'),
created_at => "$file:$line",
creator_stack => $stack,
status => 'pending',
};
# ... but we don't want to hold on to the real Future and cause cycles,
# memory isn't free
Scalar::Util::weaken($entry->{future});
my $name = "$f";
$FUTURE_MAP{$name} = $entry;
# Yes, this means we're modifying the callback list: if we later
# add support for debugging the callbacks as well, we'd need to
# take this into account.
$f->on_ready(sub {
my $f = shift;
my (undef, $file, $line) = caller(2);
lib/App/mirai/Future.pm view on Meta::CPAN
sub {
my @subs = @{$_[1]};
my $f = $constructor->(@_);
$prep->($f);
my $entry = $FUTURE_MAP{$f};
$entry->{subs} = \@subs;
# Inform subs that they have a new parent
for(@subs) {
die "missing future map entry for $_?" unless exists $FUTURE_MAP{$_};
push @{$FUTURE_MAP{$_}{deps}}, $f;
Scalar::Util::weaken($FUTURE_MAP{$_}{deps}[-1]);
}
$_->invoke_event(create => $f) for grep defined, @WATCHERS;
$f
};
},
);
# Changed in Future 0.30, I believe
$map{_new_convergent} = $map{_new_dependent};
for my $k (keys %map) {
( run in 0.269 second using v1.01-cache-2.11-cpan-65fba6d93b7 )