| 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
| |||||||||||||||||||||
| 17 | 4 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 18 | 4 | $self = bless [], $class; | |||||||||||||||||||
| 19 | 4 | ▶ | while(@args) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 22 | 4 | eval "require $name"; | |||||||||||||||||||
| 23 | 4 | ▶ | croak "$name can't be loaded: $@" if $@; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | 3 | ▶ | croak 'The former of pairs SHOULD be a name of PPI::Transform subclass: $name' if ! $name->isa('PPI::Transform'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||