Pipe/Tube/Split.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 88.8% 32 / 36 CC 3 SCAR 5.7
CC
3
Cov
93%
init
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Pipe/Tube/Sort.pm ↑ Summary Pipe/Tube/Map.pm »
1 package Pipe::Tube::Split;
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 3 ▶sub init {
Subroutine init: called CC=3 SCAR=11.2
Pod undocumented
11 3 my ($self, $expr) = @_;
12 3 $self->logger("Receiving the split expression: $expr");
13 3 ▶ if ("Regexp" eq ref $expr) {
Branch: 2 branches
BranchTrueFalseTotal
if ('Regexp' eq ref $expr) { } 1 2 3
elsif (not ref $expr) { } 2 0 2
14 1 $self->{expr} = $expr;
15 } elsif (not ref $expr) {
16 2 $self->{expr} = qr/\Q$expr/;
17 } else {
18 0 die "Unrecognized type of parameter for split\n";
19 }
20 3 return $self;
21 }
22  
23 12 ▶sub run {
Subroutine run: called CC=1 SCAR=0.0
Pod undocumented
24 12 my ($self, @input) = @_;
25  
26 12 $self->logger("The grep expression: $self->{expr}");
27 12 return map { [ split /$self->{expr}/, $_ ] } @input;
28 }
29  
30 1 1;
31  
« Pipe/Tube/Sort.pm ↑ Summary Pipe/Tube/Map.pm »