blib/lib/Pinto/Schema/ResultSet/Registration.pm

filter: Statementstmt 88.4% 23 / 26 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 4 totaltotal 61.8% 34 / 55 CC 6 SCAR 9.4
CC
6
Cov
73%
with_revision
6.0
as_hash
3.4
with_package
2.1
CRAP 2.6
« blib/lib/Pinto/Role/UserAgent.pm ↑ Summary blib/lib/Pinto/Target/Distribution.pm »
1 # ABSTRACT: Common queries for Registrations
2  
3 63 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Pinto::Schema::ResultSet::Registration;
6  
7 63 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 63 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 63 ▶use base 'DBIx::Class::ResultSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #------------------------------------------------------------------------------
13  
14 63 our $VERSION = '0.14'; # VERSION
15  
16 #------------------------------------------------------------------------------
17  
18 12 ▶sub with_package {
Subroutine with_package: called CC=2 SCAR=7.2
Pod undocumented
19 12 my ( $self, $where ) = @_;
20  
21 12 ▶ return $self->search( $where || {}, { prefetch => 'package' } );
Condition50%1/2
$where || {}
l!l
012
MC/DC0%0/1
$where || {}
$where
Truth table50%1/2
A
A= $where
Aresult
11
00
22 }
23  
24 #------------------------------------------------------------------------------
25  
26 12 ▶sub with_distribution {
Subroutine with_distribution: called CC=2 SCAR=7.2
Pod undocumented
27 12 my ( $self, $where ) = @_;
28  
29 12 ▶ return $self->search( $where || {}, { prefetch => 'distribution' } );
Condition50%1/2
$where || {}
l!l
012
MC/DC0%0/1
$where || {}
$where
Truth table50%1/2
A
A= $where
Aresult
11
00
30 }
31  
32 #------------------------------------------------------------------------------
33  
34 0 ▶sub with_revision {
Subroutine with_revision: not called CC=2 SCAR=17.9
Pod undocumented
35 0 my ( $self, $where ) = @_;
36  
37 0 ▶ return $self->search( $where || {}, { revision => 'distribution' } );
Condition0%0/2
$where || {}
l!l
00
MC/DC0%0/1
$where || {}
$where
Truth table0%0/2
A
A= $where
Aresult
11
00
38 }
39  
40 #------------------------------------------------------------------------------
41  
42 12 ▶sub as_hash {
Subroutine as_hash: called CC=3 SCAR=12.3
Pod undocumented
43 12 my ( $self, $cb ) = @_;
44  
45 0 ▶ $cb ||= sub { return ( $_[0]->id => $_[0] ) };
Subroutine __ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$cb ||= sub { return $_[0]->id, $_[0]; }
l!l&&r!l&&!r
1200
MC/DC0%0/2
$cb ||= sub { return $_[0]->id, $_[0]; }
$cb sub { return $_[0]->id, $_[0]; }
Truth table33%1/3
A ||= B
A= $cbB= sub { return $_[0]->id, $_[0]; }
ABresult
1X1
011
000
46 12 my %hash = map { $cb->($_) } $self->all;
47  
48 12 ▶ return wantarray ? %hash : \%hash;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 12 0 12
49 }
50  
51 #------------------------------------------------------------------------------
52 63 1;
53  
54 __END__
« blib/lib/Pinto/Role/UserAgent.pm ↑ Summary blib/lib/Pinto/Target/Distribution.pm »