| 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
Condition100%3/3
ref $column eq "HASH" or ref $column eq "ARRAY"
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"
| |||||||||||||||||||||||||||||
| 17 | 2 | $opt = $where; | |||||||||||||||||||||||||||
| 18 | 2 | $where = $column; | |||||||||||||||||||||||||||
| 19 | 2 | $column = '*'; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 4 | ▶ | $column ||= '*'; | ||||||||||||||||||||||||||
|
Condition100%2/2
$column ||= "*"
MC/DC100%1/1
$column ||= "*"
$column
Truth table100%2/2
A
A= $column
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||