lib/MySQL/Util/Lite/Schema.pm

filter: Statementstmt 59.1% 29 / 49 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 9 / 12 Podpod n/a totaltotal 48.7% 38 / 78 CC 10 SCAR 28.1
CC
10
Cov
45%
get_table
43.8
_build_tables
7.9
get_tables
3.7
CRAP 16.6
« lib/MySQL/Util/Lite.pm ↑ Summary lib/MySQL/Util/Lite/PrimaryKey.pm »
1 package MySQL::Util::Lite::Schema;
2  
3 1 our $VERSION = '0.01';
4  
5 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Data::Printer alias => 'pdump';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use MySQL::Util::Lite::Table;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 has name => (
13 is => 'ro',
14 isa => 'Str',
15 required => 1,
16 );
17  
18 1 has tables => (
19 is => 'rw',
20 isa => 'ArrayRef[MySQL::Util::Lite::Table]',
21 lazy => 1,
22 builder => '_build_tables',
23 );
24  
25 1 has _util => (
26 is => 'ro',
27 isa => 'MySQL::Util',
28 required => 1,
29 );
30  
31 0 ▶method get_table (Str $name) {
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine get_table: not called CC=7 SCAR=37.8
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($name) 0 0 0
if scalar @_ > 1 0 0 0
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"} "Method::Signatures"->_make_constraint("Str")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
ABresult
1X1
011
000
32  
33 0 my @tables = $self->get_tables;
34 0 foreach my $t (@tables) {
35 0 ▶ if ( $t->name eq $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t->name eq $name) 0 0 0
36 0 return $t;
37 }
38 }
39 }
40  
41 0 ▶method get_tables {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine get_tables: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
42
43 0 return @{ $self->tables };
44 }
45  
46 0 ▶method _build_tables {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine _build_tables: not called CC=3 SCAR=20.7
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
47  
48 0 my $aref = $self->_util->get_tables;
49  
50 0 my @ret;
51 0 foreach my $table (@$aref) {
52 0 push @ret,
53 MySQL::Util::Lite::Table->new(
54 name => $table,
55 schema_name => $self->name,
56 _util => $self->_util
57 );
58 }
59  
60 0 return \@ret;
61 }
62  
63 1 1;
« lib/MySQL/Util/Lite.pm ↑ Summary lib/MySQL/Util/Lite/PrimaryKey.pm »