DBI/Relationship.pm

filter: Statementstmt 92.6% 38 / 41 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 75.0% 3 / 4 totaltotal 88.8% 56 / 63 CC 5 SCAR 6.3
CC
5
Cov
91%
_add_triggers
3.0
_add_methods
3.0
remap_arguments
2.0
CRAP 1.9
« DBI/Cascade/Fail.pm ↑ Summary DBI/Column.pm »
1 package Class::DBI::Relationship;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use base 'Class::Accessor::Fast';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 __PACKAGE__->mk_accessors(qw/name class accessor foreign_class args/);
9  
10 5 ▶sub set_up {
Subroutine set_up: called CC=1 SCAR=0.0
Pod undocumented
11 5 my $proto = shift;
12 5 my $self = $proto->_init(@_);
13 5 $self->_set_up_class_data;
14 5 $self->_add_triggers;
15 5 $self->_add_methods;
16 5 $self;
17 }
18  
19 5 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
20 5 my $proto = shift;
21 5 my $name = shift;
22 5 my ($class, $accessor, $foreign_class, $args) = $proto->remap_arguments(@_);
23 5 $class->clear_object_index;
24 5 return $proto->new(
25 {
26 name => $name,
27 class => $class,
28 foreign_class => $foreign_class,
29 accessor => $accessor,
30 args => $args,
31 }
32 );
33 }
34  
35 0 ▶sub remap_arguments {
Subroutine remap_arguments: not called CC=1 SCAR=6.9
Pod documented
36 0 my $self = shift;
37 0 return @_;
38 }
39  
40 5 ▶sub _set_up_class_data {
Subroutine _set_up_class_data: called CC=1 SCAR=0.0
41 5 my $self = shift;
42 5 $self->class->_extend_meta($self->name => $self->accessor => $self);
43 }
44  
45 0 ▶sub triggers { () }
Subroutine triggers: not called CC=1 SCAR=6.9
Pod documented
46  
47 5 ▶sub _add_triggers {
Subroutine _add_triggers: called CC=3 SCAR=11.0
48 5 my $self = shift;
49  
50 # need to treat as list in case there are multiples for the same point.
51 5 ▶ my @triggers = $self->triggers or return;
Branch: 1 branch
BranchTrueFalseTotal
my(@triggers) = $self->triggers or return 5 0 5
52 5 ▶ while (my ($point, $subref) = (splice @triggers, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@triggers, 0, 2)) 14 5 19
53 14 $self->class->add_trigger($point => $subref);
54 }
55 }
56  
57 3 ▶sub methods { () }
Subroutine methods: called CC=1 SCAR=0.0
Pod documented
58  
59 5 ▶sub _add_methods {
Subroutine _add_methods: called CC=3 SCAR=11.0
60 5 my $self = shift;
61 5 ▶ my %methods = $self->methods or return;
Branch: 1 branch
BranchTrueFalseTotal
my(%methods) = $self->methods or return 2 3 5
62 2 my $class = $self->class;
63 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
64 2 foreach my $method (keys %methods) {
65 4 *{"$class\::$method"} = $methods{$method};
66 }
67 }
68  
69 4 1;
70  
71 __END__
« DBI/Cascade/Fail.pm ↑ Summary DBI/Column.pm »