blib/lib/Otogiri/Plugin/Count.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 97.6% 42 / 43 CC 4 SCAR 8.5
CC
4
Cov
100%
count
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
↑ Summary
1 package Otogiri::Plugin::Count;
2 2 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = "0.02";
7  
8 2 ▶use Otogiri;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Otogiri::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our @EXPORT = qw(count);
12  
13 4 ▶sub count {
Subroutine count: called CC=4 SCAR=13.9
Pod undocumented
14 4 my ($self, $table, $column, $where, $opt) = @_;
15  
16 4 ▶ if ( ref $column eq 'HASH' || ref $column eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $column eq "HASH" or ref $column eq "ARRAY") 2 2 4
Condition100%3/3
ref $column eq "HASH" or ref $column eq "ARRAY"
l!l&&r!l&&!r
112
MC/DC100%2/2
ref $column eq "HASH" or ref $column eq "ARRAY"
ref $column eq "HASH" ref $column eq "ARRAY"
Truth table100%3/3
A or B
A= ref $column eq "HASH"B= ref $column eq "ARRAY"
ABresult
1X1
011
000
17 2 $opt = $where;
18 2 $where = $column;
19 2 $column = '*';
20 }
21  
22 4 ▶ $column ||= '*';
Condition100%2/2
$column ||= "*"
l!l
31
MC/DC100%1/1
$column ||= "*"
$column
Truth table100%2/2
A
A= $column
Aresult
11
00
23  
24 4 my ($sql, @binds) = $self->maker->select($table, [\"COUNT($column)"], $where, $opt);
25  
26 4 my ($cnt) = $self->dbh->selectrow_array($sql, {}, @binds);
27 4 return $cnt;
28 }
29  
30 2 1;
31 __END__
↑ Summary