| 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
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
$self->{"dbh"}->isa("DBI::db") or $self->{"dbh"}->isa("Test::Mock::Geoffrey::DBI")
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")
| |||||||||||||||||||||||||||||
| 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"
MC/DC100%1/1
$_[0]{"converter_name"} //= "SQLite"
$_[0]{"converter_name"}
Truth table100%2/2
A
A= $_[0]{"converter_name"}
| |||||||||||||||||||||||||||||
| 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"
MC/DC100%1/1
$_[0]{"io_name"} //= "None"
$_[0]{"io_name"}
Truth table100%2/2
A
A= $_[0]{"io_name"}
| |||||||||||||||||||||||||||||
| 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"
MC/DC0%0/1
$_[0]{"system"} // "main"
$_[0]{"system"}
Truth table0%0/2
A
A= $_[0]{"system"}
| |||||||||||||||||||||||||||||
| 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)
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)
| |||||||||||||||||||||||||||||
| 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)
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)
| |||||||||||||||||||||||||||||
| 53 | 11 | ▶ | $self->{changelog_io}->converter($self->converter) if $self->{changelog_io}->needs_converter; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 11 | ▶ | $self->{changelog_io}->dbh($self->dbh) if $self->{changelog_io}->needs_dbh; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 11 | ▶ | $self->{changelog_io}->schema($self->schema) if $self->schema; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 11 | return $self->{changelog_io}; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 7 | 1; # End of Geoffrey::Role::Core | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||