lib/SQL/Admin/Driver/Base.pm

filter: Statementstmt 35.0% 14 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 26.6% 4 / 15 Podpod 0.0% 0 / 10 totaltotal 23.6% 18 / 76 CC 6 SCAR 16.5
CC
6
Cov
29%
_load_and_new
12.0
save
12.0
new
6.0
CRAP 5.2
« lib/SQL/Admin/Catalog/Table.pm ↑ Summary lib/SQL/Admin/Catalog/Object.pm »
1  
2 package SQL::Admin::Driver::Base;
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 SQL::Admin;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Module::Load qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 ######################################################################
15 ######################################################################
16 0 ▶sub new { # ;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
17 0 my $class = shift;
18 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
19  
20 ##################################################################
21  
22 0 bless {
23 @_,
24 -sql_admin_search => [ $class, __PACKAGE__ ],
25 }, $class;
26 }
27  
28  
29 ######################################################################
30 ######################################################################
31 0 ▶sub _load_and_new { # ;
Subroutine _load_and_new: not called CC=3 SCAR=24.8
32 0 my ($self, $what) = (shift, shift);
33 0 my $retval;
34  
35 0 for (@{ $self->{-sql_admin_search} }) {
36 0 ▶ $retval ||= eval { SQL::Admin->_load_and_new ($_ . '::' . $what, @_) };
Condition0%0/3
$retval ||= eval { do { "SQL::Admin"->_load_and_new($_ . '::' . $what, @_) } }
l!l&&r!l&&!r
000
MC/DC0%0/2
$retval ||= eval { do { "SQL::Admin"->_load_and_new($_ . '::' . $what, @_) } }
$retval eval { do { "SQL::Admin"->_load_and_new($_ . '::' . $what, @_) } }
Truth table0%0/3
A ||= B
A= $retvalB= eval { do { "SQL::Admin"->_load_and_new($_ . '::' . $what, @_) } }
ABresult
1X1
011
000
37 }
38  
39 ##################################################################
40  
41 0 $retval;
42 }
43  
44  
45 ######################################################################
46 ######################################################################
47 0 ▶sub options {
Subroutine options: not called CC=1 SCAR=6.9
Pod undocumented
48 (
49 0 'file|f=s@'
50 )
51 }
52  
53  
54 ######################################################################
55 ######################################################################
56 0 ▶sub evaluate { # ;
Subroutine evaluate: not called CC=1 SCAR=6.9
Pod undocumented
57 0 shift->evaluator->evaluate (@_);
58 }
59  
60  
61 ######################################################################
62 ######################################################################
63 0 ▶sub decompose { # ;
Subroutine decompose: not called CC=1 SCAR=6.9
Pod undocumented
64 0 shift->decomposer ->decompose (@_);
65 }
66  
67  
68 ######################################################################
69 ######################################################################
70 0 ▶sub decomposer { # ;
Subroutine decomposer: not called CC=1 SCAR=6.9
Pod undocumented
71 0 shift->_load_and_new ('Decompose', @_);
72 }
73  
74  
75 ######################################################################
76 ######################################################################
77 0 ▶sub evaluator { # ;
Subroutine evaluator: not called CC=1 SCAR=6.9
Pod undocumented
78 0 shift->_load_and_new ('Evaluate', @_);
79 }
80  
81  
82 ######################################################################
83 ######################################################################
84 0 ▶sub producer { # ;
Subroutine producer: not called CC=1 SCAR=6.9
Pod undocumented
85 0 shift->_load_and_new ('Producer', @_);
86 }
87  
88  
89 ######################################################################
90 ######################################################################
91 0 ▶sub parser { # ;
Subroutine parser: not called CC=1 SCAR=6.9
Pod undocumented
92 0 shift->_load_and_new ('Parser', @_);
93 }
94  
95  
96 ######################################################################
97 ######################################################################
98 0 ▶sub load { # ;
Subroutine load: not called CC=1 SCAR=6.9
Pod undocumented
99 0 my ($self, $catalog, @params) = @_;
100  
101 0 $self->evaluate (
102 $catalog,
103 $self->parser (%$self )->load (@params)
104 );
105 }
106  
107  
108 ######################################################################
109 ######################################################################
110 0 ▶sub save { # ;
Subroutine save: not called CC=3 SCAR=24.8
Pod undocumented
111 0 my ($self, $catalog, @params) = @_;
112 0 my $fh = \*STDOUT;
113  
114 0 ▶ if ($self->{file}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"file"}) 0 0 0
115 0 my $file = $self->{file}[0];
116 0 ▶ open $fh, '>', $file
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">", $file or die "Unable write to ${file}: $!\n" 0 0 0
117 or die "Unable write to $file: $!\n";
118 }
119  
120 ##################################################################
121  
122 print $fh $self->producer (@params)->produce (
123 0 @{ $self->decompose ($catalog) }
124 );
125 }
126  
127  
128 ######################################################################
129 ######################################################################
130  
131 package SQL::Admin::Driver::Base;
132  
133 1 1;
134  
135 __END__
« lib/SQL/Admin/Catalog/Table.pm ↑ Summary lib/SQL/Admin/Catalog/Object.pm »