Helper/Row/ProxyResultSetMethod.pm

filter: Statementstmt 90.3% 47 / 52 Branchbran 66.6% 4 / 6 Conditioncond 77.7% 7 / 9 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 91.6% 11 / 12 Podpod 100% 3 / 3 totaltotal 85.0% 74 / 87 CC 9 SCAR 7.7
CC
9
Cov
87%
proxy_resultset_method
4.2
__ANON__
2.2
id_plus_one
2.2
CRAP 2.2
« Helper/Row/OnColumnMissing.pm ↑ Summary Helper/Schema/Verifier/ColumnInfo.pm »
1 package DBIx::Class::Helper::Row::ProxyResultSetMethod;
2 56 $DBIx::Class::Helper::Row::ProxyResultSetMethod::VERSION = '2.037000';
3 # ABSTRACT: Efficiently reuse ResultSet methods from results with fallback
4  
5 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 56 ▶use parent 'DBIx::Class::Helper::Row::SelfResultSet', 'DBIx::Class::Row';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 56 ▶use Sub::Name ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 56 ▶use DBIx::Class::Candy::Exports;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 56 export_methods [qw( proxy_resultset_method )];
15  
16 56 __PACKAGE__->mk_group_accessors(inherited => '_proxy_slots');
17  
18 112 ▶sub proxy_resultset_method {
Subroutine proxy_resultset_method: called CC=4 SCAR=14.3
Pod documented
19 112 my ($self, $name, $attr) = @_;
20  
21 112 ▶ my $rs_method = $attr->{resultset_method} || "with_$name";
Condition100%2/2
$attr->{'resultset_method'} || "with_$name"
l!l
5656
MC/DC100%1/1
$attr->{'resultset_method'} || "with_$name"
$attr->{'resultset_method'}
Truth table100%2/2
A
A= $attr->{'resultset_method'}
Aresult
11
00
22 112 ▶ my $slot = $attr->{slot} || $name;
Condition66%2/3
$attr->{'slot'} || $name
l!l&&r!l&&!r
56560
MC/DC0%0/2
$attr->{'slot'} || $name
$attr->{'slot'} $name
Truth table66%2/3
A || B
A= $attr->{'slot'}B= $name
ABresult
1X1
011
000
23  
24 112 ▶ $self->_proxy_slots([]) unless $self->_proxy_slots;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_proxy_slots 56 56 112
25 112 push @{$self->_proxy_slots}, $slot;
26  
27 56 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 112 my $method = $self . '::' . $name;
29 112 ▶ *{$method} = Sub::Name::subname $method, sub {
Subroutine __ANON__: called CC=2 SCAR=8.0
Subroutine id_plus_two: not called CC=2 SCAR=8.0
30 0 my ($self) = @_;
31 56 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 0 ▶ unless ($self->has_column_loaded($slot)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->has_column_loaded($slot)) 4 2 6
unless ($self->has_column_loaded($slot)) 0 0 0
34 # boo. The accessor checks that there's an actual column defined, so we
35 # skip it so we can cache results.
36 0 $self->{_column_data}{$slot} = undef;
37 0 $self->set_column(
38 $slot,
39 $self->self_rs
40 ->search(undef, { columns => [] })
41 ->$rs_method
42 ->get_column($slot)
43 ->next,
44 );
45 }
46  
47 0 return $self->get_column($slot)
48 }
49 112 }
50  
51 2 ▶sub copy {
Subroutine copy: called CC=2 SCAR=6.9
Pod documented
52 2 ▶ delete local @{$_[0]->{_column_data}}{@{$_[0]->_proxy_slots||[]}};
Condition100%2/2
$_[0]->_proxy_slots || []
l!l
11
MC/DC100%1/1
$_[0]->_proxy_slots || []
$_[0]->_proxy_slots
Truth table100%2/2
A
A= $_[0]->_proxy_slots
Aresult
11
00
53  
54 2 shift->next::method(@_);
55 }
56  
57 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
Pod documented
58 1 ▶ delete local @{$_[0]->{_dirty_columns}}{@{$_[0]->_proxy_slots||[]}};
Condition50%1/2
$_[0]->_proxy_slots || []
l!l
10
MC/DC0%0/1
$_[0]->_proxy_slots || []
$_[0]->_proxy_slots
Truth table50%1/2
A
A= $_[0]->_proxy_slots
Aresult
11
00
59  
60 1 shift->next::method(@_);
61 }
62  
63 56 1;
64  
65 __END__
« Helper/Row/OnColumnMissing.pm ↑ Summary Helper/Schema/Verifier/ColumnInfo.pm »