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