lib/Flux/Mapper.pm

filter: Statementstmt 89.7% 35 / 39 Branchbran 75.0% 9 / 12 Conditioncond 53.3% 8 / 15 MC/DCmcdc 30.0% 3 / 10 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 73.4% 61 / 83 CC 12 SCAR 23.8
CC
12
Cov
79%
__ANON__
15.7
BEGIN
1.0
__ANON__
1.0
CRAP 10.8
« lib/Flux/In/Role/Easy.pm ↑ Summary lib/Flux/Storage/Formatted.pm »
1 package Flux::Mapper;
2 {
3 7 $Flux::Mapper::VERSION = '1.03';
4 }
5  
6 # ABSTRACT: interface for transforming input or output streams.
7  
8  
9 7 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 7 ▶use Flux::Out;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 7 ▶use overload '|' => sub {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=12 SCAR=27.5
17 4 my ($left, $right, $swap) = @_;
18  
19 4 require Flux::Mapper::MappedIn;
20 4 require Flux::Mapper::MappedOut;
21 4 require Flux::Mapper::MappedMapper;
22  
23 4 ▶ if ($swap) {
Branch: 1 branch
BranchTrueFalseTotal
if ($swap) 2 2 4
24 2 ($left, $right) = ($right, $left);
25 }
26 4 ▶ unless (blessed $left and $left->can('does')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($left) and $left->can("does")) 0 4 4
Condition33%1/3
builtin::blessed($left) and $left->can("does")
!ll&&!rl&&r
004
MC/DC0%0/2
builtin::blessed($left) and $left->can("does")
builtin::blessed($left) $left->can("does")
Truth table33%1/3
A and B
A= builtin::blessed($left)B= $left->can("does")
ABresult
0X0
100
111
27 0 croak "Left side of pipe is not a flux object, but '$left'";
28 }
29 4 ▶ unless (blessed $right and $right->can('does')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($right) and $right->can("does")) 0 4 4
Condition33%1/3
builtin::blessed($right) and $right->can("does")
!ll&&!rl&&r
004
MC/DC0%0/2
builtin::blessed($right) and $right->can("does")
builtin::blessed($right) $right->can("does")
Truth table33%1/3
A and B
A= builtin::blessed($right)B= $right->can("does")
ABresult
0X0
100
111
30 0 croak "Right side of pipe is not a flux object, but '$right'";
31 }
32  
33 4 ▶ if ($left->does('Flux::Mapper') and $right->does('Flux::Mapper')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left->does("Flux::Mapper") and $right->does("Flux::Mapper")) 1 3 4
Condition100%3/3
$left->does("Flux::Mapper") and $right->does("Flux::Mapper")
!ll&&!rl&&r
211
MC/DC100%2/2
$left->does("Flux::Mapper") and $right->does("Flux::Mapper")
$left->does("Flux::Mapper") $right->does("Flux::Mapper")
Truth table100%3/3
A and B
A= $left->does("Flux::Mapper")B= $right->does("Flux::Mapper")
ABresult
0X0
100
111
34 # m | m
35 1 return Flux::Mapper::MappedMapper->new(left => $left, right => $right);
36 }
37  
38 3 ▶ if ($left->does('Flux::Mapper') and $right->does('Flux::Out')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left->does("Flux::Mapper") and $right->does("Flux::Out")) 1 2 3
Condition66%2/3
$left->does("Flux::Mapper") and $right->does("Flux::Out")
!ll&&!rl&&r
201
MC/DC50%1/2
$left->does("Flux::Mapper") and $right->does("Flux::Out")
$left->does("Flux::Mapper") $right->does("Flux::Out")
Truth table66%2/3
A and B
A= $left->does("Flux::Mapper")B= $right->does("Flux::Out")
ABresult
0X0
100
111
39 # m | o
40 1 return Flux::Mapper::MappedOut->new(mapper => $left, out => $right);
41 }
42  
43 2 ▶ if ($left->does('Flux::In') and $right->does('Flux::Mapper')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left->does("Flux::In") and $right->does("Flux::Mapper")) 2 0 2
Condition33%1/3
$left->does("Flux::In") and $right->does("Flux::Mapper")
!ll&&!rl&&r
002
MC/DC0%0/2
$left->does("Flux::In") and $right->does("Flux::Mapper")
$left->does("Flux::In") $right->does("Flux::Mapper")
Truth table33%1/3
A and B
A= $left->does("Flux::In")B= $right->does("Flux::Mapper")
ABresult
0X0
100
111
44 # i | m
45 2 return Flux::Mapper::MappedIn->new(in => $left, mapper => $right);
46 }
47  
48 0 croak "Strange arguments '$left' and '$right'";
49  
50 0 ▶}, '""' => sub { $_[0] }; # strangely, when I overload |, I need to overload other operators too...
Subroutine __ANON__: not called CC=1 SCAR=0.2
51  
52 7 requires 'write';
53  
54 7 requires 'write_chunk';
55  
56 7 requires 'commit';
57  
58  
59 7 1;
60  
61 __END__
« lib/Flux/In/Role/Easy.pm ↑ Summary lib/Flux/Storage/Formatted.pm »