File Coverage

blib/lib/Promises6/Promise.pm
Criterion Covered Total %
statement 11 11 100.0
branch 1 2 50.0
condition n/a
subroutine 2 2 100.0
pod 1 1 100.0
total 15 16 93.7


line stmt bran cond sub pod time code
1             package Promises6::Promise;
2 30     30   14179 use Evo -class, -modern;
  30         33  
  30         161  
3              
4             has [qw(builder)];
5             has deferred => sub { Carp::croak 'build me using deferred object' };
6              
7 150 50   150 1 1277 sub then($self, @subs) {
  150         131  
  150         274  
  150         130  
8 150         315 my $d = $self->builder->deferred;
9 150         1191 my $listener = $self->builder->listener(cbs => \@subs, deferred => $d);
10              
11 150         965 $self->deferred->subscribe($listener);
12 150         409 $d->promise;
13             }
14              
15             1;
16              
17             # ABSTRACT: A promise.
18              
19             __END__