Helper/Row/SubClass.pm

filter: Statementstmt 100% 32 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 100% 43 / 43 CC 2 SCAR 2.0
CC
2
Cov
100%
generate_relationships
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Helper/ResultSet/SearchOr.pm ↑ Summary Helper/Row/RelationshipDWIM.pm »
1 package DBIx::Class::Helper::Row::SubClass;
2 56 $DBIx::Class::Helper::Row::SubClass::VERSION = '2.037000';
3 # ABSTRACT: Convenient subclassing with DBIx::Class
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::Row';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 56 ▶use DBIx::Class::Helpers::Util qw{get_namespace_parts assert_similar_namespaces};
Subroutine BEGIN: called CC=1 SCAR=0.0
11 56 ▶use DBIx::Class::Candy::Exports;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 56 export_methods [qw(subclass generate_relationships set_table)];
14  
15 112 ▶sub subclass {
Subroutine subclass: called CC=1 SCAR=0.0
Pod documented
16 112 my $self = shift;
17 112 my $namespace = shift;
18 112 $self->set_table;
19 112 $self->generate_relationships($namespace);
20 }
21  
22 112 ▶sub generate_relationships {
Subroutine generate_relationships: called CC=2 SCAR=6.9
Pod documented
23 112 my $self = shift;
24 112 my ($namespace) = get_namespace_parts($self);
25 112 foreach my $rel ($self->relationships) {
26 336 my $rel_info = $self->relationship_info($rel);
27 336 my $class = $rel_info->{class};
28  
29 336 assert_similar_namespaces($self, $class);
30 336 my (undef, $result) = get_namespace_parts($class);
31  
32 $self->add_relationship(
33 $rel,
34 "${namespace}::$result",
35 $rel_info->{cond},
36 $rel_info->{attrs}
37 336 );
38 };
39 }
40  
41 112 ▶sub set_table {
Subroutine set_table: called CC=1 SCAR=0.0
Pod documented
42 112 my $self = shift;
43 112 $self->table($self->table);
44 }
45  
46 56 1;
47  
48 __END__
« Helper/ResultSet/SearchOr.pm ↑ Summary Helper/Row/RelationshipDWIM.pm »