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   16657 use Evo::Base -base;
  30         40  
  30         170  
3              
4             has [qw(builder)];
5             has deferred => sub { Carp::croak 'build me using deferred object' };
6              
7 150 50   150 1 4872 sub then($self, @subs) {
  150         169  
  150         373  
  150         143  
8 150         2571 my $d = $self->builder->deferred;
9 150         3724 my $listener = $self->builder->listener(cbs => \@subs, deferred => $d);
10              
11 150         3781 $self->deferred->subscribe($listener);
12 150         6464 $d->promise;
13             }
14              
15             1;
16              
17             # ABSTRACT: A promise.
18              
19             __END__