blib/lib/DBIx/Class/Schema/Loader/RelBuilder/Compat/v0_040.pm

filter: Statementstmt 100% 28 / 28 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 95.0% 38 / 40 CC 4 SCAR 8.5
CC
4
Cov
94%
_relnames_and_method
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« blib/lib/DBIx/Class/Schema/Loader/Utils.pm ↑ Summary blib/lib/DBIx/Class/Schema/Loader/RelBuilder/Compat/v0_05.pm »
1 package DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use base 'DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_05';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.07053';
9  
10 58 ▶sub _relnames_and_method {
Subroutine _relnames_and_method: called CC=4 SCAR=13.9
11 58 my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_;
12  
13 58 my $remote_moniker = $rel->{remote_source};
14 58 my $remote_table = $rel->{remote_table};
15  
16 58 my $local_table = $rel->{local_table};
17 58 my $local_cols = $rel->{local_columns};
18  
19 # for single-column case, set the remote relname to just the column name
20 my ($local_relname) =
21 58 ▶ scalar keys %{$cond} == 1
Branch: 1 branch
BranchTrueFalseTotal
scalar keys %{$cond;} == 1 ? : 58 0 58
22 ? $self->_inflect_singular( values %$cond )
23 : $self->_inflect_singular( lc $remote_table );
24  
25 # If more than one rel between this pair of tables, use the local
26 # col names to distinguish
27 58 my $remote_relname;
28 58 ▶ if ($counters->{$remote_moniker} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($counters->{$remote_moniker} > 1) { } 16 42 58
29 16 my $colnames = '_' . join( '_', @$local_cols );
30 16 ▶ $local_relname .= $colnames if keys %$cond > 1;
Branch: 1 branch
BranchTrueFalseTotal
if keys %$cond > 1 0 16 16
31 16 ($remote_relname) = $self->_inflect_plural( lc($local_table) . $colnames );
32 } else {
33 42 ($remote_relname) = $self->_inflect_plural(lc $local_table);
34 }
35  
36 58 return ( $local_relname, $remote_relname, 'has_many' );
37 }
38  
39 58 ▶sub _remote_attrs { }
Subroutine _remote_attrs: called CC=1 SCAR=0.0
40  
41 =head1 NAME
42  
43 DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040 - RelBuilder for
44 compatibility with DBIx::Class::Schema::Loader version 0.04006
45  
46 =head1 DESCRIPTION
47  
48 See L<DBIx::Class::Schema::Loader::Base/naming> and
49 L<DBIx::Class::Schema::Loader::RelBuilder>.
50  
51 =head1 AUTHORS
52  
53 See L<DBIx::Class::Schema::Loader/AUTHORS>.
54  
55 =head1 LICENSE
56  
57 This library is free software; you can redistribute it and/or modify it under
58 the same terms as Perl itself.
59  
60 =cut
61  
62 2 1;
« blib/lib/DBIx/Class/Schema/Loader/Utils.pm ↑ Summary blib/lib/DBIx/Class/Schema/Loader/RelBuilder/Compat/v0_05.pm »