lib/SQL/Admin.pm

filter: Statementstmt 40.5% 15 / 37 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 4 totaltotal 24.6% 19 / 77 CC 11 SCAR 26.3
CC
11
Cov
26%
get_catalog
30.0
new
12.0
get_driver
12.0
CRAP 13.9
« lib/SQL/Admin/Driver/Base/Decompose.pm ↑ Summary lib/SQL/Admin/Driver/Pg/Producer.pm »
1  
2 package SQL::Admin;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = v0.5.0;
8  
9 ######################################################################
10  
11 1 ▶use Module::Load qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use SQL::Admin::Utils qw( refarray );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 ######################################################################
15  
16 1 our %CATALOG_MAP;
17  
18 ######################################################################
19 ######################################################################
20 0 ▶sub new { # ;
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
21 0 my $class = shift;
22 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
23  
24 0 ▶ bless {
Branch: 1 branch
BranchTrueFalseTotal
$class ne __PACKAGE__ ? : 0 0 0
25 -sql_admin_search => [ $class, $class ne __PACKAGE__ ? __PACKAGE__ : () ],
26 }, $class;
27 }
28  
29  
30 ######################################################################
31 ######################################################################
32 0 ▶sub _load_and_new { # ;
Subroutine _load_and_new: not called CC=1 SCAR=6.9
33 0 my ($self, $class, @args) = @_;
34  
35 0 Module::Load::load ($class);
36 0 $class->new (@args);
37 }
38  
39  
40 ######################################################################
41 ######################################################################
42 0 ▶sub get_driver { # ;
Subroutine get_driver: not called CC=3 SCAR=24.8
Pod undocumented
43 0 my ($self, $name, @args) = @_;
44 0 my $retval;
45  
46 0 $retval ||= eval { $self->_load_and_new ($_ . '::Driver::' . $name, @args) }
47 0 ▶ for @{ $self->{-sql_admin_search} };
Condition0%0/3
$retval ||= eval { do { $self->_load_and_new($_ . '::Driver::' . $name, @args) } }
l!l&&r!l&&!r
000
MC/DC0%0/2
$retval ||= eval { do { $self->_load_and_new($_ . '::Driver::' . $name, @args) } }
$retval eval { do { $self->_load_and_new($_ . '::Driver::' . $name, @args) } }
Truth table0%0/3
A ||= B
A= $retvalB= eval { do { $self->_load_and_new($_ . '::Driver::' . $name, @args) } }
ABresult
1X1
011
000
48  
49 ##################################################################
50  
51 0 $retval;
52 }
53  
54  
55 ######################################################################
56 ######################################################################
57 0 ▶sub get_catalog { # ;
Subroutine get_catalog: not called CC=5 SCAR=34.0
Pod undocumented
58 0 my ($self, $name, @args) = @_;
59  
60 0 my $cat;
61 $cat = $CATALOG_MAP{$name}
62 0 ▶ if ( (defined $name) and ($CATALOG_MAP{$name}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $name and $SQL::Admin::CATALOG_MAP{$name} 0 0 0
Condition0%0/3
defined $name and $SQL::Admin::CATALOG_MAP{$name}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and $SQL::Admin::CATALOG_MAP{$name}
defined $name $SQL::Admin::CATALOG_MAP{$name}
Truth table0%0/3
A and B
A= defined $nameB= $SQL::Admin::CATALOG_MAP{$name}
ABresult
0X0
100
111
63  
64 0 ▶ $cat ||= $self->_load_and_new ('SQL::Admin::Catalog', @args);
Condition0%0/3
$cat ||= $self->_load_and_new("SQL::Admin::Catalog", @args)
l!l&&r!l&&!r
000
MC/DC0%0/2
$cat ||= $self->_load_and_new("SQL::Admin::Catalog", @args)
$cat $self->_load_and_new("SQL::Admin::Catalog", @args)
Truth table0%0/3
A ||= B
A= $catB= $self->_load_and_new("SQL::Admin::Catalog", @args)
ABresult
1X1
011
000
65  
66 0 ▶ $CATALOG_MAP{$name} = $cat if defined $name;
Branch: 1 branch
BranchTrueFalseTotal
if defined $name 0 0 0
67  
68 ##################################################################
69  
70 0 $cat;
71 }
72  
73  
74 ######################################################################
75 ######################################################################
76 0 ▶sub compare { # ;
Subroutine compare: not called CC=3 SCAR=24.8
Pod undocumented
77 0 my $self = shift;
78 0 ▶ my $args = shift if @_ > 2;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 2 0 0 0
79  
80 0 ▶ my ($src, $dst) = map refarray ($_) ? $self->get_catalog->load (@$_) : $_, @_;
Branch: 1 branch
BranchTrueFalseTotal
&refarray($_) ? : 0 0 0
81  
82 0 $self
83 ->_load_and_new ('SQL::Admin::Catalog::Compare', %$args)
84 ->compare ($src, $dst)
85 ;
86 }
87  
88  
89 ######################################################################
90 ######################################################################
91  
92 package SQL::Admin;
93  
94 1 1;
95  
96 __END__
« lib/SQL/Admin/Driver/Base/Decompose.pm ↑ Summary lib/SQL/Admin/Driver/Pg/Producer.pm »