QueryByName/Result/Iterator.pm

filter: Statementstmt 51.6% 16 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 100% 3 / 3 totaltotal 44.4% 24 / 54 CC 5 SCAR 20.5
CC
5
Cov
40%
new
20.0
to_list
6.0
next
2.0
CRAP 7.8
« QueryByName/Result/ScalarIterator.pm ↑ Summary QueryByName/Logger.pm »
1 package DBIx::QueryByName::Result::Iterator;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DBIx::QueryByName::Logger qw(get_logger);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
9 0 my ($class,$query,$sth) = @_;
10 0 ▶ get_logger->logcroak("undefined query name")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $query 0 0 0
11 if (!defined $query);
12 0 ▶ get_logger->logcroak("undefined sth or not a sth")
Branch: 1 branch
BranchTrueFalseTotal
if not defined $sth or ref $sth ne "DBI::st" 0 0 0
Condition0%0/3
not defined $sth or ref $sth ne "DBI::st"
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $sth or ref $sth ne "DBI::st"
not defined $sth ref $sth ne "DBI::st"
Truth table0%0/3
not(A) or B
A= not defined $sthB= ref $sth ne "DBI::st"
ABresult
1X1
011
000
13 if (!defined $sth || ref $sth ne 'DBI::st');
14 0 return bless( { query => $query, sth => $sth }, $class);
15 }
16  
17 0 ▶sub next { die "BUG: not implemented" }
Subroutine next: not called CC=1 SCAR=6.9
Pod documented
18  
19 0 ▶sub to_list {
Subroutine to_list: not called CC=2 SCAR=17.9
Pod documented
20 0 my $self = shift;
21  
22 0 my @r;
23 0 while (1) {
24 0 my $v = $self->next;
25  
26 # Abort when sth is gone, we can't check for undef
27 # value in $v because NULL is a valid return from a
28 # query
29 0 ▶ last unless $self->{sth};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"sth"} 0 0 0
30  
31 0 push @r, $v;
32 }
33  
34 0 return @r;
35 }
36  
37 0 ▶sub _finish_and_croak {
Subroutine _finish_and_croak: not called CC=1 SCAR=6.9
38 0 my ($self,$msg) = @_;
39 0 $self->{sth}->finish;
40 0 get_logger->logcroak($msg);
41 }
42  
43 1 1;
44  
45 __END__
« QueryByName/Result/ScalarIterator.pm ↑ Summary QueryByName/Logger.pm »