Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make on-based supplies also work well with .close.
  • Loading branch information
jnthn committed Apr 21, 2014
1 parent 9605613 commit ca00d7b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/Supply.pm
Expand Up @@ -164,7 +164,8 @@ sub on(&setup) {
}

method tap(|c) {
my $sub = self.Supply::tap(|c);
my @to_close;
my $sub = self.Supply::tap(|c, on_close => { .close for @to_close });
my @tappers = &!setup(self);
my $lock = Lock.new;

Expand All @@ -174,10 +175,10 @@ sub on(&setup) {
}
given $what {
when EnumMap {
self!add_source($source, $lock, $index, |$what);
@to_close.push(self!add_source($source, $lock, $index, |$what));
}
when Callable {
self!add_source($source, $lock, $index, more => $what);
@to_close.push(self!add_source($source, $lock, $index, more => $what));
}
default {
X::Supply::On::BadSetup.new.throw;
Expand Down

0 comments on commit ca00d7b

Please sign in to comment.