DBomb/Query/GroupBy.pm

filter: Statementstmt 42.4% 14 / 33 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 33.9% 18 / 53 CC 6 SCAR 19.9
CC
6
Cov
33%
init
12.0
append
12.0
sql
6.0
CRAP 7.3
« DBomb/Tie/PrimaryKeyList.pm ↑ Summary DBomb/Query/Join.pm »
1 package DBomb::Query::GroupBy;
2  
3 =head1 NAME
4  
5 DBomb::Query::GroupBy - An ORDER BY clause.
6  
7 =head1 SYNOPSIS
8  
9 =cut
10  
11 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 our $VERSION = '$Revision: 1.2 $';
14  
15 12 ▶use Carp::Assert;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 use Class::MethodMaker
17 12 ▶ 'new_with_init' => 'new',
Subroutine BEGIN: called CC=1 SCAR=0.0
18 'get_set' => [qw(names)],
19 12 ;
20  
21 ## new GroupBy([cols,...])
22 ## new GroupBy(cols,...)
23 0 ▶sub init {
Subroutine init: not called CC=3 SCAR=24.8
Pod undocumented
24 0 my $self = shift;
25 0 assert(@_ > 0, 'valid parameters');
26 0 ▶ assert(@_ == 1 ? (ref($_[0])? ref($_[0]) eq 'ARRAY' : 1) : 1, 'valid parameters');
Branch: 2 branches
BranchTrueFalseTotal
@_ == 1 ? : 0 0 0
ref $_[0] ? : 0 0 0
27  
28 0 $self->names([]);
29 0 $self->append(@_);
30 }
31  
32 0 ▶sub append {
Subroutine append: not called CC=3 SCAR=24.8
Pod undocumented
33 0 my $self = shift;
34  
35 0 ▶ if (UNIVERSAL::isa($_[0],__PACKAGE__)){
Branch: 2 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($_[0], __PACKAGE__)) { } 0 0 0
elsif (ref $_[0] eq 'ARRAY') { } 0 0 0
36 0 push @{$self->names}, @{$_[0]->names};
37 }
38 elsif (ref($_[0]) eq 'ARRAY'){
39 0 push @{$self->names}, @{$_->[0]}
40 }
41 else {
42 0 push @{$self->names}, @_;
43 }
44 }
45  
46 0 ▶sub sql {
Subroutine sql: not called CC=2 SCAR=17.9
Pod undocumented
47 0 my ($self, $dbh) = @_;
48 0 my $names = $self->names;
49 0 ▶ return '' unless @$names;
Branch: 1 branch
BranchTrueFalseTotal
unless @$names 0 0 0
50 0 return join(",", @$names);
51 }
52  
53  
54 12 1;
55 __END__
« DBomb/Tie/PrimaryKeyList.pm ↑ Summary DBomb/Query/Join.pm »