| 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
| |||||||||||||||||||||||||||||
| 24 | 2 | ($left, $right) = ($right, $left); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | 4 | ▶ | unless (blessed $left and $left->can('does')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($left) and $left->can("does")
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")
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
builtin::blessed($right) and $right->can("does")
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")
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
$left->does("Flux::Mapper") and $right->does("Flux::Mapper")
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")
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$left->does("Flux::Mapper") and $right->does("Flux::Out")
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")
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
$left->does("Flux::In") and $right->does("Flux::Mapper")
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")
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||