Helper/ResultSet/Util.pm

filter: Statementstmt 100% 16 / 16 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 92.5% 25 / 27 CC 4 SCAR 10.3
CC
4
Cov
91%
correlate
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Helper/ResultSet/SetOperations.pm ↑ Summary Helper/ResultSet/Shortcut/LimitedPage.pm »
1 package DBIx::Class::Helper::ResultSet::Util;
2 56 $DBIx::Class::Helper::ResultSet::Util::VERSION = '2.037000';
3 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Helper utilities for DBIx::Class ResultSets
7  
8 56 ▶use Sub::Exporter::Progressive -setup => {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 exports => [
10 qw( correlate ),
11 ],
12 56 };
13  
14  
15 56 my $recent_dbic;
16 2 ▶sub correlate {
Subroutine correlate: called CC=4 SCAR=14.2
Pod documented
17 2 my ($rs, $rel) = @_;
18  
19 2 my $source = $rs->result_source;
20  
21 2 ▶ $recent_dbic = $source->can('resolve_relationship_condition') ? 1 : 0
Branch: 2 branches
BranchTrueFalseTotal
unless defined $recent_dbic 1 1 2
$source->can('resolve_relationship_condition') ? : 0 1 1
22 if not defined $recent_dbic;
23  
24 return $source->related_source($rel)->resultset
25 ->search(
26  
27 ($recent_dbic
28  
29 ? $source->resolve_relationship_condition(
30 rel_name => $rel,
31 foreign_alias => "${rel}_alias",
32 self_alias => $rs->current_source_alias,
33 )->{condition}
34  
35 : scalar $source->_resolve_condition(
36 $source->relationship_info($rel)->{cond},
37 2 ▶ "${rel}_alias",
Branch: 1 branch
BranchTrueFalseTotal
$recent_dbic ? : 0 2 2
38 $rs->current_source_alias,
39 $rel
40 )
41  
42 ),
43  
44 { alias => "${rel}_alias" }
45 );
46 }
47  
48 56 1;
49  
50 __END__
« Helper/ResultSet/SetOperations.pm ↑ Summary Helper/ResultSet/Shortcut/LimitedPage.pm »