Geoffrey/Role/Core.pm

filter: Statementstmt 97.5% 40 / 41 Branchbran 70.0% 7 / 10 Conditioncond 73.3% 11 / 15 MC/DCmcdc 44.4% 4 / 9 Subroutinesub 92.3% 12 / 13 Podpod 100% 9 / 9 totaltotal 85.5% 83 / 97 CC 12 SCAR 11.3
CC
12
Cov
88%
environment_system
6.0
changelog_io
5.4
new
4.0
CRAP 3.1
« Geoffrey/Action/Constraint.pm ↑ Summary Geoffrey/Role/Converter.pm »
1 package Geoffrey::Role::Core;
2  
3 7 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 $Geoffrey::Role::Core::VERSION = '0.000206';
9  
10 18 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
11 18 my $class = shift;
12 18 my $self = {@_};
13  
14 # make dbh required
15 18 ▶ if (!$self->{dbh}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"dbh"}) 4 14 18
16 4 require Geoffrey::Exception::Database;
17 4 Geoffrey::Exception::Database::throw_no_dbh();
18 }
19  
20 # be sure thet dbh is realy a DBI::db object or a test DBI
21 14 ▶ if (!$self->{dbh}->isa('DBI::db') && !$self->{dbh}->isa('Test::Mock::Geoffrey::DBI')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"dbh"}->isa("DBI::db") or $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")) 1 13 14
Condition100%3/3
$self->{"dbh"}->isa("DBI::db") or $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")
l!l&&r!l&&!r
1211
MC/DC100%2/2
$self->{"dbh"}->isa("DBI::db") or $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")
$self->{"dbh"}->isa("DBI::db") $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")
Truth table100%3/3
A or B
A= $self->{"dbh"}->isa("DBI::db")B= $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")
ABresult
1X1
011
000
22 1 require Geoffrey::Exception::Database;
23 1 Geoffrey::Exception::Database::throw_not_dbh();
24 }
25 13 return bless $self, $class;
26 }
27  
28 3 ▶sub converter_name {
Subroutine converter_name: called CC=2 SCAR=6.9
Pod documented
29 3 ▶ $_[0]->{converter_name} //= 'SQLite';
Condition100%2/2
$_[0]{"converter_name"} //= "SQLite"
l!l
12
MC/DC100%1/1
$_[0]{"converter_name"} //= "SQLite"
$_[0]{"converter_name"}
Truth table100%2/2
A
A= $_[0]{"converter_name"}
Aresult
11
00
30 3 return $_[0]->{converter_name};
31 }
32  
33 8 ▶sub io_name {
Subroutine io_name: called CC=2 SCAR=6.9
Pod documented
34 8 ▶ $_[0]->{io_name} //= 'None';
Condition100%2/2
$_[0]{"io_name"} //= "None"
l!l
53
MC/DC100%1/1
$_[0]{"io_name"} //= "None"
$_[0]{"io_name"}
Truth table100%2/2
A
A= $_[0]{"io_name"}
Aresult
11
00
35 8 return $_[0]->{io_name};
36 }
37 92 ▶sub dbh { return $_[0]->{dbh} }
Subroutine dbh: called CC=1 SCAR=0.0
Pod documented
38 12 ▶sub schema { return $_[0]->{schema} }
Subroutine schema: called CC=1 SCAR=0.0
Pod documented
39 0 ▶sub environment_system { return $_[0]->{system} // 'main'; }
Subroutine environment_system: not called CC=2 SCAR=17.9
Pod documented
Condition0%0/2
$_[0]{"system"} // "main"
l!l
00
MC/DC0%0/1
$_[0]{"system"} // "main"
$_[0]{"system"}
Truth table0%0/2
A
A= $_[0]{"system"}
Aresult
11
00
40 1 ▶sub disconnect { return $_[0]->{dbh}->disconnect; }
Subroutine disconnect: called CC=1 SCAR=0.0
Pod documented
41  
42 99 ▶sub converter {
Subroutine converter: called CC=2 SCAR=7.0
Pod documented
43 99 my ($self) = @_;
44 99 require Geoffrey::Utils;
45 99 ▶ $self->{converter} //= Geoffrey::Utils::converter_obj_from_name($self->converter_name);
Condition66%2/3
$self->{"converter"} //= Geoffrey::Utils::converter_obj_from_name($self->converter_name)
l!l&&r!l&&!r
9630
MC/DC0%0/2
$self->{"converter"} //= Geoffrey::Utils::converter_obj_from_name($self->converter_name)
$self->{"converter"} Geoffrey::Utils::converter_obj_from_name($self->converter_name)
Truth table66%2/3
A //= B
A= $self->{"converter"}B= Geoffrey::Utils::converter_obj_from_name($self->converter_name)
ABresult
1X1
011
000
46 99 return $self->{converter};
47 }
48  
49 11 ▶sub changelog_io {
Subroutine changelog_io: called CC=5 SCAR=16.8
Pod documented
50 11 my ($self) = @_;
51 11 require Geoffrey::Utils;
52 11 ▶ $self->{changelog_io} //= Geoffrey::Utils::changelog_io_from_name($self->io_name);
Condition66%2/3
$self->{"changelog_io"} //= Geoffrey::Utils::changelog_io_from_name($self->io_name)
l!l&&r!l&&!r
830
MC/DC0%0/2
$self->{"changelog_io"} //= Geoffrey::Utils::changelog_io_from_name($self->io_name)
$self->{"changelog_io"} Geoffrey::Utils::changelog_io_from_name($self->io_name)
Truth table66%2/3
A //= B
A= $self->{"changelog_io"}B= Geoffrey::Utils::changelog_io_from_name($self->io_name)
ABresult
1X1
011
000
53 11 ▶ $self->{changelog_io}->converter($self->converter) if $self->{changelog_io}->needs_converter;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"changelog_io"}->needs_converter 0 11 11
54 11 ▶ $self->{changelog_io}->dbh($self->dbh) if $self->{changelog_io}->needs_dbh;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"changelog_io"}->needs_dbh 0 11 11
55 11 ▶ $self->{changelog_io}->schema($self->schema) if $self->schema;
Branch: 1 branch
BranchTrueFalseTotal
if $self->schema 0 11 11
56 11 return $self->{changelog_io};
57 }
58  
59 7 1; # End of Geoffrey::Role::Core
60  
61 __END__
« Geoffrey/Action/Constraint.pm ↑ Summary Geoffrey/Role/Converter.pm »