blib/lib/DBIO/Base.pm

filter: Statementstmt 92.7% 51 / 55 Branchbran 70.0% 7 / 10 Conditioncond 60.0% 3 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 93.7% 15 / 16 Podpod 100% 5 / 5 totaltotal 88.3% 83 / 94 CC 8 SCAR 11.4
CC
8
Cov
87%
_attr_cache
12.0
get_component_class
4.0
MODIFY_CODE_ATTRIBUTES
2.0
CRAP 3.1
« blib/lib/DBIO/Timestamp.pm ↑ Summary blib/lib/DBIO/Storage/DBI/AutoCast.pm »
1 package DBIO::Base;
2 # ABSTRACT: Meta-infrastructure base for all DBIO internal classes
3  
4 388 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 388 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 388 our $VERSION = '0.900007';
8  
9 388 ▶use DBIO::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 388 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 388 ▶use DBIO::Optional::Dependencies;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 388 ▶use base qw/DBIO::Componentised Class::Accessor::Grouped/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 388 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 388 ▶use DBIO::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 388 my $successfully_loaded_components;
19  
20  
21 43449 ▶sub get_component_class {
Subroutine get_component_class: called CC=4 SCAR=13.9
Pod documented
22 43449 my $class = $_[0]->get_inherited($_[1]);
23  
24 43449 ▶ return $class if Scalar::Util::blessed($class);
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($class) 2 43447 43449
25  
26 43447 ▶ if (defined $class and ! $successfully_loaded_components->{$class} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $class and not $successfully_loaded_components->{$class}) 13826 29621 43447
Condition100%3/3
defined $class and not $successfully_loaded_components->{$class}
!ll&&!rl&&r
32961813826
MC/DC100%2/2
defined $class and not $successfully_loaded_components->{$class}
defined $class not $successfully_loaded_components->{$class}
Truth table100%3/3
A and not(B)
A= defined $classB= not $successfully_loaded_components->{$class}
ABresult
0X0
100
111
27 13826 $_[0]->ensure_class_loaded($class);
28  
29 388 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
30 $successfully_loaded_components->{$class}
31 13818 = ${"${class}::__LOADED__BY__DBIO__CAG__COMPONENT_CLASS__"}
32 13818 = do { \(my $anon = 'loaded') };
33 13818 Scalar::Util::weaken($successfully_loaded_components->{$class});
34 }
35  
36 43439 $class;
37 }
38  
39  
40 4934 ▶sub set_component_class {
Subroutine set_component_class: called CC=1 SCAR=0.0
Pod documented
41 4934 shift->set_inherited(@_);
42 }
43  
44 388 __PACKAGE__->mk_group_accessors(inherited => '_skip_namespace_frames');
45 388 __PACKAGE__->_skip_namespace_frames('^DBIO|^SQL::Abstract|^Try::Tiny|^Class::Accessor::Grouped|^Context::Preserve');
46  
47 9014 ▶sub mk_classdata {
Subroutine mk_classdata: called CC=1 SCAR=0.0
Pod documented
48 9014 shift->mk_classaccessor(@_);
49 }
50  
51 9014 ▶sub mk_classaccessor {
Subroutine mk_classaccessor: called CC=2 SCAR=6.9
Pod documented
52 9014 my $self = shift;
53 9014 $self->mk_group_accessors('inherited', $_[0]);
54 9014 ▶ $self->set_inherited(@_) if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 6575 2439 9014
55 }
56  
57 5841 ▶sub component_base_class { 'DBIO' }
Subroutine component_base_class: called CC=1 SCAR=0.0
Pod documented
58  
59 2 ▶sub MODIFY_CODE_ATTRIBUTES {
Subroutine MODIFY_CODE_ATTRIBUTES: called CC=2 SCAR=7.0
60 2 my ($class,$code,@attrs) = @_;
61 2 ▶ $class->mk_classdata('__attr_cache' => {})
Branch: 1 branch
BranchTrueFalseTotal
unless $class->can("__attr_cache") 2 0 2
62 unless $class->can('__attr_cache');
63 2 $class->__attr_cache->{$code} = [@attrs];
64 2 return ();
65 }
66  
67 0 ▶sub _attr_cache {
Subroutine _attr_cache: not called CC=3 SCAR=24.8
68 0 my $self = shift;
69 0 ▶ my $cache = $self->can('__attr_cache') ? $self->__attr_cache : {};
Branch: 1 branch
BranchTrueFalseTotal
$self->can('__attr_cache') ? : 0 0 0
70  
71 return {
72 %$cache,
73 0 ▶ %{ $self->maybe::next::method || {} },
Condition0%0/2
$self->maybe::next::method || {}
l!l
00
MC/DC0%0/1
$self->maybe::next::method || {}
$self->maybe::next::method
Truth table0%0/2
A
A= $self->maybe::next::method
Aresult
11
00
74 };
75 }
76  
77 388 1;
78  
79 __END__
« blib/lib/DBIO/Timestamp.pm ↑ Summary blib/lib/DBIO/Storage/DBI/AutoCast.pm »