Pipe/Tube/Grep.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 94.1% 32 / 34 CC 2 SCAR 2.5
CC
2
Cov
100%
run
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Pipe/Tube/For.pm ↑ Summary Pipe/Tube/Find.pm »
1 package Pipe::Tube::Grep;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Pipe::Tube';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.06';
9  
10 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
11 2 my ($self, $expr) = @_;
12 2 $self->logger("Receiving the grep expression: $expr");
13 2 $self->{expr} = $expr;
14 2 return $self;
15 }
16  
17 14 ▶sub run {
Subroutine run: called CC=2 SCAR=6.9
Pod undocumented
18 14 my ($self, @input) = @_;
19  
20 14 $self->logger("The grep expression: $self->{expr}");
21 14 ▶ if ("Regexp" eq ref $self->{expr}) {
Branch: 1 branch
BranchTrueFalseTotal
if ('Regexp' eq ref $self->{'expr'}) { } 7 7 14
22 7 return grep /$self->{expr}/, @input;
23 } else {
24 7 my $sub = $self->{expr};
25 7 return grep { $sub->($_) } @input;
26 }
27 }
28  
29 1 1;
30  
« Pipe/Tube/For.pm ↑ Summary Pipe/Tube/Find.pm »