blib/lib/Bootylicious/IteratorSearchable.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 95.0% 38 / 40 CC 5 SCAR 8.5
CC
5
Cov
100%
find_first
3.0
find_all
3.0
BEGIN
1.0
CRAP 2.3
« blib/lib/Bootylicious/Article.pm ↑ Summary blib/lib/Bootylicious/ArticleArchiveBase.pm »
1 package Bootylicious::IteratorSearchable;
2  
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 ▶use base 'Bootylicious::Decorator';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub find_first {
9 11 ▶ my $self = shift;
Subroutine find_first: called CC=3 SCAR=11.0
Pod undocumented
10 11 my $cb = shift;
11  
12 11 $self->rewind;
13  
14 11 ▶ while (my $el = $self->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $el = $self->next) 15 5 20
15 15 ▶ if (my $res = $cb->($self->object, $el)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $res = &$cb($self->object, $el)) 6 9 15
16 6 return $res;
17 }
18 }
19  
20 5 return;
21 }
22  
23 sub find_all {
24 9 ▶ my $self = shift;
Subroutine find_all: called CC=3 SCAR=11.0
Pod undocumented
25 9 my $cb = shift;
26  
27 9 $self->rewind;
28  
29 9 my @found_elements;
30 9 ▶ while (my $el = $self->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $el = $self->next) 20 9 29
31 20 ▶ if (my $res = $cb->($self->object, $el)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $res = &$cb($self->object, $el)) 8 12 20
32 8 push @found_elements, $res;
33 }
34 }
35  
36 9 return Bootylicious::Iterator->new(elements => [@found_elements]);
37 }
38  
39 12 1;
« blib/lib/Bootylicious/Article.pm ↑ Summary blib/lib/Bootylicious/ArticleArchiveBase.pm »