| 1 | package # hide from PAUSE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | DBIx::Class::Relationship::ProxyMethods; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 308 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 308 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 308 | ▶ | use Sub::Name (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 308 | ▶ | use base qw/DBIx::Class/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 308 | our %_pod_inherit_config = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | class_map => { 'DBIx::Class::Relationship::ProxyMethods' => 'DBIx::Class::Relationship' } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | sub register_relationship { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 25614 | ▶ | my ($class, $rel, $info) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_relationship: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 25614 | ▶ | if (my $proxy_args = $info->{attrs}{proxy}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1850 | $class->proxy_to_related($rel, $proxy_args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 25612 | $class->next::method($rel, $info); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | sub proxy_to_related { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1850 | ▶ | my ($class, $rel, $proxy_args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proxy_to_related: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1850 | my %proxy_map = $class->_build_proxy_map_from($proxy_args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 308 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 308 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1848 | foreach my $meth_name ( keys %proxy_map ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2772 | my $proxy_to_col = $proxy_map{$meth_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2772 | my $name = join '::', $class, $meth_name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | *$name = Sub::Name::subname $name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
link_url: not called CC=4 SCAR=23.3
Subroutine
cd_title: called CC=4 SCAR=23.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $relobj = $self->$rel; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if (@_ && !defined $relobj) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
@_ and not defined $relobj
@_ and not defined $relobj
MC/DC0%0/2
@_ and not defined $relobj
@_
not defined $relobj
MC/DC0%0/2
@_ and not defined $relobj
@_
not defined $relobj
Truth table0%0/3
A and not(B)
A= @_B= not defined $relobj
Truth table33%1/3
A and not(B)
A= @_B= not defined $relobj
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $relobj = $self->create_related($rel, { $proxy_to_col => $_[0] }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | return ($relobj ? $relobj->$proxy_to_col(@_) : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2772 | } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | sub _build_proxy_map_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1850 | ▶ | my ( $class, $proxy_arg ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_proxy_map_from: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1850 | my $ref = ref $proxy_arg; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1850 | ▶ | if ($ref eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 924 | return %$proxy_arg; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | elsif ($ref eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 616 | ▶ | (ref $_ eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ? (%$_) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | : ($_ => $_) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } @$proxy_arg; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | elsif ($ref) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | $class->throw_exception("Unable to process the 'proxy' argument $proxy_arg"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 308 | return ( $proxy_arg => $proxy_arg ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 308 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||