TableDataRole/Util/GetRowByPos.pm

filter: Statementstmt 46.6% 21 / 45 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 37.3% 25 / 67 CC 7 SCAR 21.5
CC
7
Cov
37%
has_item_at_pos
12.0
get_item_at_pos
12.0
get_row_at_pos_hashref
12.0
CRAP 8.6
« TableDataRole/Munge/SerializeRef.pm ↑ Summary TableDataRole/Source/DBI.pm »
1 package TableDataRole::Util::GetRowByPos;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2024-05-14'; # DATE
11 1 our $DIST = 'TableDataRoles-Standard'; # DIST
12 1 our $VERSION = '0.025'; # VERSION
13  
14 1 requires 'reset_iterator';
15 1 requires 'has_next_item';
16 1 requires 'get_next_item';
17 1 requires 'get_next_row_hashref';
18 1 with 'TableDataRole::Spec::GetRowByPos';
19  
20 0 ▶sub has_item_at_pos {
Subroutine has_item_at_pos: not called CC=3 SCAR=24.8
Pod undocumented
21 0 my ($self, $index) = @_;
22 0 $self->reset_iterator;
23 0 my $i = 0;
24 # XXX implement caching?
25 0 ▶ while ($i < $index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $index) 0 0 0
26 0 ▶ die "StopIteration" unless $self->has_next_item;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_next_item 0 0 0
27 0 $self->get_next_item;
28 0 $i++;
29 }
30 0 $self->has_next_item;
31 }
32  
33 0 ▶sub get_item_at_pos {
Subroutine get_item_at_pos: not called CC=3 SCAR=24.8
Pod undocumented
34 0 my ($self, $index) = @_;
35 0 $self->reset_iterator;
36 0 my $i = 0;
37 # XXX implement caching?
38 0 ▶ while ($i < $index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $index) 0 0 0
39 0 ▶ die "StopIteration" unless $self->has_next_item;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_next_item 0 0 0
40 0 $self->get_next_item;
41 0 $i++;
42 }
43 0 $self->get_next_item;
44 }
45  
46 0 ▶sub get_row_at_pos_hashref {
Subroutine get_row_at_pos_hashref: not called CC=3 SCAR=24.8
Pod undocumented
47 0 my ($self, $index) = @_;
48 0 $self->reset_iterator;
49 0 my $i = 0;
50 # XXX implement caching?
51 0 ▶ while ($i < $index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $index) 0 0 0
52 0 ▶ die "StopIteration" unless $self->has_next_item;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_next_item 0 0 0
53 0 $self->get_next_item;
54 0 $i++;
55 }
56 0 $self->get_next_row_hashref;
57 }
58  
59 1 1;
60 # ABSTRACT: Provide TableDataRole::Spec::GetRowByPos methods using iteration
61  
62 __END__
« TableDataRole/Munge/SerializeRef.pm ↑ Summary TableDataRole/Source/DBI.pm »