blib/lib/PMLTQ/Relation/OptionalIterator.pm

filter: Statementstmt 56.8% 29 / 51 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 56.2% 9 / 16 Podpod 0.0% 0 / 7 totaltotal 43.6% 38 / 87 CC 6 SCAR 14.2
CC
6
Cov
47%
start
12.0
new
6.0
next
6.0
CRAP 4.1
« blib/lib/PMLTQ/Relation/MemberIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/ParentIterator.pm »
1 package PMLTQ::Relation::OptionalIterator;
2 12 our $AUTHORITY = 'cpan:MATY';
3 12 $PMLTQ::Relation::OptionalIterator::VERSION = '1.2.2';
4 # ABSTRACT: Creates optional interator branch
5  
6 12 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 ▶use base qw(PMLTQ::Relation::Iterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 12 ▶use constant CONDITIONS=>0;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use constant ITERATOR=>1;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 ▶use constant NODE=>2;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 12 ▶use constant FILE=>3;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 12 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub new {
18 0 ▶ my ($class,$iterator)=@_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
19 0 ▶ croak "usage: $class->new(\$iterator)" unless UNIVERSAL::DOES::does($iterator,'PMLTQ::Relation::Iterator');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::DOES::does($iterator, "PMLTQ::Relation::Iterator") 0 0 0
20 0 return bless [$iterator->conditions,$iterator],$class;
21 }
22 sub clone {
23 0 ▶ my ($self)=@_;
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
24 0 return bless [$self->[CONDITIONS],$self->[ITERATOR]], ref($self);
25 }
26 sub start {
27 0 ▶ my ($self,$parent,$fsfile)=@_;
Subroutine start: not called CC=3 SCAR=24.8
Pod undocumented
28 0 $self->[NODE]=$parent;
29 0 $self->[FILE]=$fsfile;
30 0 ▶ return $parent ? ($self->[CONDITIONS]->($parent,$fsfile) ? $parent : $self->next) : undef;
Branch: 2 branches
BranchTrueFalseTotal
$parent ? : 0 0 0
$self->[0]->($parent, $fsfile) ? : 0 0 0
31 }
32 sub next {
33 0 ▶ my ($self)=@_;
Subroutine next: not called CC=2 SCAR=17.9
Pod undocumented
34 0 my $n = $self->[NODE];
35 0 ▶ if ($n) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n) 0 0 0
36 0 $self->[NODE]=undef;
37 0 return $self->[ITERATOR]->start($n,$self->[FILE]);
38 }
39 0 return $self->[ITERATOR]->next;
40 }
41 sub node {
42 0 ▶ my ($self)=@_;
Subroutine node: not called CC=2 SCAR=17.9
Pod undocumented
43 0 ▶ return $self->[NODE] || $self->[ITERATOR]->node;
Condition0%0/3
$self->[2] || $self->[1]->node
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->[2] || $self->[1]->node
$self->[2] $self->[1]->node
Truth table0%0/3
A || B
A= $self->[2]B= $self->[1]->node
ABresult
1X1
011
000
44 }
45 sub file {
46 0 ▶ return $_[0]->[FILE];
Subroutine file: not called CC=1 SCAR=6.9
Pod undocumented
47 }
48 sub reset {
49 0 ▶ my ($self)=@_;
Subroutine reset: not called CC=1 SCAR=6.9
Pod undocumented
50 0 $self->[NODE]=undef;
51 0 $self->[FILE]=undef;
52 0 $self->[ITERATOR]->reset;
53 }
54  
55 12 1; # End of PMLTQ::Relation::OptionalIterator
56  
57 __END__
« blib/lib/PMLTQ/Relation/MemberIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/ParentIterator.pm »