Pager/Logic/Count.pm

filter: Statementstmt 57.1% 16 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 45.6% 21 / 46 CC 5 SCAR 27.4
CC
5
Cov
44%
get_total_entries
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 15.5
↑ Summary Mixin/SearchWithPager.pm »
1 package DBIx::Skinny::Pager::Logic::Count;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use base qw/DBIx::Skinny::Pager/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Data::Page;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use DBIx::Skinny::SQL;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub get_total_entries {
Subroutine get_total_entries: not called CC=5 SCAR=34.0
Pod undocumented
9 0 my ($self, $iter) = @_;
10 0 my %hash = %{ $self };
11 0 for my $col ( qw( limit offset page select order ) ) {
12 0 delete $hash{$col};
13 }
14 0 my $rs = DBIx::Skinny::SQL->new(\%hash);
15 0 $rs->add_select("COUNT(*)" => 'cnt');
16 0 my $new_iter = $rs->retrieve;
17 0 ▶ if ( $rs->group && ( ref $rs->group eq 'ARRAY' && @{ $rs->group } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rs->group and (ref $rs->group eq 'ARRAY' and @{$rs->group;})) { } 0 0 0
Condition0%0/6
$rs->group and (ref $rs->group eq "ARRAY" and @{$rs->group;})
!ll&&!rl&&r
000
ref $rs->group eq "ARRAY" and @{$rs->group;}
!ll&&!rl&&r
000
MC/DC0%0/3
$rs->group and (ref $rs->group eq "ARRAY" and @{$rs->group;})
$rs->group ref $rs->group eq "ARRAY" @{$rs->group;}
Truth table0%0/4
A and B and C
A= $rs->groupB= ref $rs->group eq "ARRAY"C= @{$rs->group;}
ABCresult
0XX0
10X0
1100
1111
18 # are there better way?
19 0 return $new_iter->count;
20 } else {
21 0 return $new_iter->first->cnt;
22 }
23 }
24  
25 3 1;
26 __END__
↑ Summary Mixin/SearchWithPager.pm »