File Coverage

blib/lib/Text/Pipe/List/Reduce.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 24 25 96.0


line stmt bran cond sub pod time code
1             package Text::Pipe::List::Reduce;
2              
3 1     1   8 use warnings;
  1         2  
  1         36  
4 1     1   7 use strict;
  1         2  
  1         30  
5 1     1   7 use List::Util 'reduce';
  1         1  
  1         80  
6              
7              
8             our $VERSION = '0.10';
9              
10              
11 1     1   5 use base 'Text::Pipe::Base';
  1         1  
  1         192  
12              
13              
14             __PACKAGE__->mk_scalar_accessors(qw(code));
15              
16              
17             sub filter {
18 1     1 1 2 my ($self, $input) = @_;
19 1 50       11 return $input unless ref $input eq 'ARRAY';
20              
21             # kludge because of prototype requirements
22 1     19   20 reduce { $self->code->($a, $b) } @$input;
  19         111  
23             }
24              
25              
26             1;
27              
28              
29             __END__