line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Role::Core; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
3735
|
use utf8; |
|
7
|
|
|
|
|
44
|
|
|
7
|
|
|
|
|
40
|
|
4
|
7
|
|
|
7
|
|
291
|
use 5.016; |
|
7
|
|
|
|
|
25
|
|
5
|
7
|
|
|
7
|
|
33
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
147
|
|
6
|
7
|
|
|
7
|
|
35
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
3616
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$Geoffrey::Role::Core::VERSION = '0.000203'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
18
|
|
|
18
|
1
|
4060
|
my $class = shift; |
12
|
18
|
|
|
|
|
75
|
my $self = {@_}; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# make dbh required |
15
|
18
|
100
|
|
|
|
75
|
if (!$self->{dbh}) { |
16
|
4
|
|
|
|
|
26
|
require Geoffrey::Exception::Database; |
17
|
4
|
|
|
|
|
18
|
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
|
100
|
100
|
|
|
121
|
if (!$self->{dbh}->isa('DBI::db') && !$self->{dbh}->isa('Test::Mock::Geoffrey::DBI')) { |
22
|
1
|
|
|
|
|
7
|
require Geoffrey::Exception::Database; |
23
|
1
|
|
|
|
|
6
|
Geoffrey::Exception::Database::throw_not_dbh(); |
24
|
|
|
|
|
|
|
} |
25
|
13
|
|
|
|
|
120
|
return bless $self, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub converter_name { |
29
|
3
|
|
100
|
3
|
1
|
20
|
$_[0]->{converter_name} //= 'SQLite'; |
30
|
3
|
|
|
|
|
13
|
return $_[0]->{converter_name}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub io_name { |
34
|
8
|
|
100
|
8
|
1
|
42
|
$_[0]->{io_name} //= 'None'; |
35
|
8
|
|
|
|
|
33
|
return $_[0]->{io_name}; |
36
|
|
|
|
|
|
|
} |
37
|
92
|
|
|
92
|
1
|
598
|
sub dbh { return $_[0]->{dbh} } |
38
|
12
|
|
|
12
|
1
|
65
|
sub schema { return $_[0]->{schema} } |
39
|
0
|
|
0
|
0
|
1
|
0
|
sub environment_system { return $_[0]->{system} // 'main'; } |
40
|
1
|
|
|
1
|
1
|
2439
|
sub disconnect { return $_[0]->{dbh}->disconnect; } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub converter { |
43
|
99
|
|
|
99
|
1
|
227
|
my ($self) = @_; |
44
|
99
|
|
|
|
|
2252
|
require Geoffrey::Utils; |
45
|
99
|
|
66
|
|
|
389
|
$self->{converter} //= Geoffrey::Utils::converter_obj_from_name($self->converter_name); |
46
|
99
|
|
|
|
|
576
|
return $self->{converter}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub changelog_io { |
50
|
11
|
|
|
11
|
1
|
28
|
my ($self) = @_; |
51
|
11
|
|
|
|
|
80
|
require Geoffrey::Utils; |
52
|
11
|
|
66
|
|
|
48
|
$self->{changelog_io} //= Geoffrey::Utils::changelog_io_from_name($self->io_name); |
53
|
11
|
50
|
|
|
|
51
|
$self->{changelog_io}->converter($self->converter) if $self->{changelog_io}->needs_converter; |
54
|
11
|
50
|
|
|
|
45
|
$self->{changelog_io}->dbh($self->dbh) if $self->{changelog_io}->needs_dbh; |
55
|
11
|
50
|
|
|
|
62
|
$self->{changelog_io}->schema($self->schema) if $self->schema; |
56
|
11
|
|
|
|
|
75
|
return $self->{changelog_io}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; # End of Geoffrey::Role::Core |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |