blib/lib/PPI/Transform/Sequence.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 10 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 93.1% 54 / 58 CC 8 SCAR 14.2
CC
8
Cov
96%
new
7.0
document
2.0
BEGIN
1.0
CRAP 4.2
↑ Summary
1 package PPI::Transform::Sequence;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Tiny binder to combine multiple PPI::Transform objects
7 1 our $VERSION = 'v0.0.3'; # VERSION
8  
9 1 ▶use parent qw(PPI::Transform);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub new
14 5 ▶{
Subroutine new: called CC=7 SCAR=19.5
Pod documented
15 5 my ($self, @args) = @_;
16 5 ▶ croak 'Odd number of arguments are specified' if @args % 2 == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 == 1 1 4 5
17 4 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
18 4 $self = bless [], $class;
19 4 ▶ while(@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 5 1 6
20 5 my ($name, $arg) = splice @args, 0, 2;
21 5 ▶ croak 'The latter of pairs SHOULD be an array reference' if ref($arg) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $arg ne "ARRAY" 1 4 5
22 4 eval "require $name";
23 4 ▶ croak "$name can't be loaded: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 1 3 4
24 3 ▶ croak 'The former of pairs SHOULD be a name of PPI::Transform subclass: $name' if ! $name->isa('PPI::Transform');
Branch: 1 branch
BranchTrueFalseTotal
unless $name->isa("PPI::Transform") 1 2 3
25 2 push @$self, $name->new(@$arg);
26 }
27 1 return $self;
28 }
29  
30 sub idx
31 2 ▶{
Subroutine idx: called CC=1 SCAR=0.0
Pod documented
32 2 my ($self, $idx) = @_;
33 2 return $self->[$idx];
34 }
35  
36 sub document
37 1 ▶{
Subroutine document: called CC=2 SCAR=6.9
Pod documented
38 1 my ($self, $doc) = @_;
39 1 my $count = 0;
40 1 foreach my $trans (@$self) {
41 2 $count += $trans->document($doc);
42 }
43 1 return $count;
44 }
45  
46 1 1;
47  
48 __END__
↑ Summary