line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Role::Core; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
3573
|
use utf8; |
|
7
|
|
|
|
|
36
|
|
|
7
|
|
|
|
|
38
|
|
4
|
7
|
|
|
7
|
|
281
|
use 5.016; |
|
7
|
|
|
|
|
24
|
|
5
|
7
|
|
|
7
|
|
34
|
use strict; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
142
|
|
6
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
3695
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$Geoffrey::Role::Core::VERSION = '0.000204'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
18
|
|
|
18
|
1
|
4193
|
my $class = shift; |
12
|
18
|
|
|
|
|
69
|
my $self = {@_}; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# make dbh required |
15
|
18
|
100
|
|
|
|
81
|
if (!$self->{dbh}) { |
16
|
4
|
|
|
|
|
24
|
require Geoffrey::Exception::Database; |
17
|
4
|
|
|
|
|
19
|
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
|
|
|
|
|
41
|
require Geoffrey::Exception::Database; |
23
|
1
|
|
|
|
|
8
|
Geoffrey::Exception::Database::throw_not_dbh(); |
24
|
|
|
|
|
|
|
} |
25
|
13
|
|
|
|
|
110
|
return bless $self, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub converter_name { |
29
|
3
|
|
100
|
3
|
1
|
24
|
$_[0]->{converter_name} //= 'SQLite'; |
30
|
3
|
|
|
|
|
12
|
return $_[0]->{converter_name}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub io_name { |
34
|
8
|
|
100
|
8
|
1
|
42
|
$_[0]->{io_name} //= 'None'; |
35
|
8
|
|
|
|
|
39
|
return $_[0]->{io_name}; |
36
|
|
|
|
|
|
|
} |
37
|
92
|
|
|
92
|
1
|
632
|
sub dbh { return $_[0]->{dbh} } |
38
|
12
|
|
|
12
|
1
|
67
|
sub schema { return $_[0]->{schema} } |
39
|
0
|
|
0
|
0
|
1
|
0
|
sub environment_system { return $_[0]->{system} // 'main'; } |
40
|
1
|
|
|
1
|
1
|
2375
|
sub disconnect { return $_[0]->{dbh}->disconnect; } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub converter { |
43
|
99
|
|
|
99
|
1
|
235
|
my ($self) = @_; |
44
|
99
|
|
|
|
|
2307
|
require Geoffrey::Utils; |
45
|
99
|
|
66
|
|
|
375
|
$self->{converter} //= Geoffrey::Utils::converter_obj_from_name($self->converter_name); |
46
|
99
|
|
|
|
|
610
|
return $self->{converter}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub changelog_io { |
50
|
11
|
|
|
11
|
1
|
31
|
my ($self) = @_; |
51
|
11
|
|
|
|
|
75
|
require Geoffrey::Utils; |
52
|
11
|
|
66
|
|
|
51
|
$self->{changelog_io} //= Geoffrey::Utils::changelog_io_from_name($self->io_name); |
53
|
11
|
50
|
|
|
|
52
|
$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
|
|
|
|
76
|
$self->{changelog_io}->schema($self->schema) if $self->schema; |
56
|
11
|
|
|
|
|
80
|
return $self->{changelog_io}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; # End of Geoffrey::Role::Core |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |