Smooth/Schema.pm

filter: Statementstmt 64.8% 24 / 37 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 100% 1 / 1 totaltotal 50.7% 32 / 63 CC 8 SCAR 24.4
CC
8
Cov
48%
__ANON__
30.0
_dbix_class_smooth_create_methods
8.9
connection
6.0
CRAP 11.5
« Smooth/Functions.pm ↑ Summary Smooth/Fields.pm »
1 2 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DBIx::Class::Smooth::Schema;
6  
7 # ABSTRACT: Short intro
8 2 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9 2 our $VERSION = '0.0108';
10  
11 2 ▶use parent 'DBIx::Class::Schema';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use experimental qw/postderef signatures/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 our $dbix_class_smooth_methods_created = 0;
17  
18 0 ▶sub connection($self, @rest) {
Subroutine connection: not called CC=2 SCAR=17.9
Pod documented
19 0 $self = $self->next::method(@rest);
20  
21 0 ▶ if(!$dbix_class_smooth_methods_created) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($DBIx::Class::Smooth::Schema::dbix_class_smooth_methods_created) 0 0 0
22 0 $self->_dbix_class_smooth_create_methods();
23 }
24 0 return $self;
25 }
26  
27 0 ▶sub _dbix_class_smooth_create_methods($self) {
Subroutine _dbix_class_smooth_create_methods: not called CC=3 SCAR=21.9
28 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
29 0 for my $source (sort $self->sources) {
30 0 (my $method = $source) =~ s{::}{_}g;
31  
32 0 ▶ if($self->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can($method)) 0 0 0
33 0 croak(caller(1) . " already has a method named <$method>.");
34 }
35  
36 0 ▶ *{ caller(1) . "::$method" } = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
37 0 my $rs = shift->resultset($source);
38  
39 0 ▶ return !scalar @_ ? $rs
Branch: 3 branches
BranchTrueFalseTotal
!scalar(@_) ? : 0 0 0
defined $_[0] && !ref($_[0]) ? : 0 0 0
ref $_[0] eq 'ARRAY' ? : 0 0 0
Condition0%0/3
defined $_[0] and not ref $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and not ref $_[0]
defined $_[0] not ref $_[0]
Truth table0%0/3
A and not(B)
A= defined $_[0]B= not ref $_[0]
ABresult
0X0
100
111
40 : defined $_[0] && !ref $_[0] ? $rs->find(@_)
41 : ref $_[0] eq 'ARRAY' ? $rs->find(@$_[1..$#_], { key => $_->[0] })
42 : $rs->search(@_)
43 ;
44 0 };
45 }
46 0 $dbix_class_smooth_methods_created = 1;
47  
48 }
49  
50 2 1;
51  
52 __END__
« Smooth/Functions.pm ↑ Summary Smooth/Fields.pm »