File Coverage

lib/Flux/Mapper/MappedMapper.pm
Criterion Covered Total %
statement 11 16 68.7
branch 1 2 50.0
condition n/a
subroutine 3 4 75.0
pod 0 3 0.0
total 15 25 60.0


line stmt bran cond sub pod time code
1             package Flux::Mapper::MappedMapper;
2             {
3             $Flux::Mapper::MappedMapper::VERSION = '1.03';
4             }
5              
6             # ABSTRACT: representation of mapper|mapper
7              
8              
9 4     4   20 use Moo;
  4         7  
  4         24  
10             with 'Flux::Mapper';
11              
12             has ['left', 'right'] => (
13             is => 'ro',
14             required => 1,
15             );
16              
17             sub write {
18 1     1 0 2048 my ($self, $item) = @_;
19 1         9 my @items = $self->left->write($item);
20 1         8 my @result = map { $self->right->write($_) } @items;
  1         5  
21 1 50       13 return (wantarray ? @result : $result[0]);
22             }
23              
24             sub write_chunk {
25 1     1 0 3 my ($self, $chunk) = @_;
26 1         8 $chunk = $self->left->write_chunk($chunk);
27 1         4 return $self->right->write_chunk($chunk);
28             }
29              
30             sub commit {
31 0     0 0   my ($self) = @_;
32 0           my @items = $self->left->commit;
33 0           my $result = $self->right->write_chunk(\@items);
34 0           push @$result, $self->right->commit;
35 0           return @$result;
36             }
37              
38             1;
39              
40             __END__