BGS/Future.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 89.4% 51 / 57 CC 3 SCAR 2.9
CC
3
Cov
90%
join
2.1
new
2.1
BEGIN
1.0
CRAP 1.3
« BGS/Limit.pm ↑ Summary
1 package BGS::Future;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 our @ISA = qw(Exporter);
8 3 our @EXPORT = qw(future);
9  
10 3 our $VERSION = '0.12';
11  
12 3 ▶use overload '&{}' => sub { my $self = shift; sub { $self->join() } };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
13  
14 3 ▶use BGS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 6 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
17 6 my $proto = shift;
18 6 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
060
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
19  
20 6 my $self = BGS::_bgs_call($_[0]);
21  
22 4 bless $self, $class;
23 4 return $self;
24 }
25  
26  
27 4 ▶sub join {
Subroutine join: called CC=2 SCAR=7.4
Pod documented
28 4 my $self = shift;
29 4 ▶ if (exists $$self{result}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'result'}) { } 0 4 4
30 0 return $$self{result};
31 } else {
32 4 BGS::bgs_wait($$self{vpid});
33 4 return $$self{result};
34 }
35 }
36  
37  
38 1 ▶sub cancel {
Subroutine cancel: called CC=1 SCAR=0.0
Pod documented
39 1 my $self = shift;
40 1 BGS::bgs_break($$self{vpid});
41 }
42  
43  
44 3 ▶sub future(&) {
Subroutine future: called CC=1 SCAR=0.0
Pod documented
45 3 __PACKAGE__->new($_[0]);
46 }
47  
48  
49 3 1;
50  
51  
52 __END__
« BGS/Limit.pm ↑ Summary