DBIx/Otogiri/Iterator.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 94.4% 34 / 36 CC 3 SCAR 4.5
CC
3
Cov
97%
new
2.0
next
2.0
BEGIN
1.0
CRAP 1.6
« DBIx/Otogiri.pm ↑ Summary Otogiri.pm »
1 package DBIx::Otogiri::Iterator;
2 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use Class::Accessor::Lite (
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 new => 0,
6 ro => [qw/db sql binds table/],
7 rw => [qw/sth fetched_count/],
8 15 );
9  
10 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
11 2 my ($class, %opts) = @_;
12 2 $opts{sth} = $opts{db}->dbh->prepare($opts{sql});
13 2 ▶ $opts{sth}->execute($opts{binds} ? @{$opts{binds}} : ());
Branch: 1 branch
BranchTrueFalseTotal
$opts{'binds'} ? : 2 0 2
14 2 $opts{fetched_count} = 0;
15 2 bless {%opts}, $class;
16 }
17  
18 6 ▶sub next {
Subroutine next: called CC=2 SCAR=6.9
Pod documented
19 6 my $self = shift;
20 6 my $row = $self->sth->fetchrow_hashref;
21 6 ▶ unless ($row) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($row) 2 4 6
22 2 $self->sth->finish;
23 2 $self->{sth} = undef;
24 2 return;
25 }
26 4 $self->{fetched_count}++;
27 4 ($row) = $self->db->_inflate_rows($self->table, $row);
28 4 return $row;
29 }
30  
31 15 1;
32 __END__
« DBIx/Otogiri.pm ↑ Summary Otogiri.pm »