TaskPipe/Iterator_Array.pm

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 14.2% 1 / 7 Podpod n/a totaltotal 32.4% 12 / 37 CC 2 SCAR 10.5
CC
2
Cov
37%
__ANON__
6.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.8
« TaskPipe/Template_Task.pm ↑ Summary TaskPipe/UserAgentManager/UserAgentHandler.pm »
1 package TaskPipe::Iterator_Array;
2  
3 40 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 extends 'TaskPipe::Iterator';
5 40 with 'MooseX::ConfigCascade';
6  
7 40 has array => (is => 'rw', isa => 'ArrayRef', required => 1);
8 40 has array_pointer => (is => 'rw', isa => 'Int', default => 0);
9  
10 has 'next' => (is => 'rw', isa => 'CodeRef', lazy => 1, default => sub{
11 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=5.7
12 return sub{
13 0 ▶ my $result;
Subroutine __ANON__: not called CC=2 SCAR=17.9
14 0 ▶ if ( $self->array_pointer > $#{$self->array} ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->array_pointer > $#{$self->array;}) { } 0 0 0
15 0 $result = undef;
16 } else {
17 0 $result = $self->array->[ $self->array_pointer ];
18 0 $self->array_pointer( $self->array_pointer + 1 );
19 }
20 0 return $result;
21 }
22 0 });
23  
24  
25 has 'reset' => (is => 'rw', isa => 'CodeRef', lazy => 1, default => sub{
26 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 return sub{
28 0 ▶ my ($index) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 0 $self->array_pointer( $index );
30 0 };
31 40 });
32  
33  
34 has 'count' => (is => 'rw', isa => 'CodeRef', lazy => 1, default => sub{
35 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 return sub{
37 0 ▶ return +scalar @{$self->array};
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 0 };
39 40 });
40  
41  
42  
43 40 1;
« TaskPipe/Template_Task.pm ↑ Summary TaskPipe/UserAgentManager/UserAgentHandler.pm »