| 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
| |||||||||||||||||||||||||||||
| 11 | if (!defined $query); | ||||||||||||||||||||||||||||
| 12 | 0 | ▶ | get_logger->logcroak("undefined sth or not a sth") | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $sth or ref $sth ne "DBI::st"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||