line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Schema::Data; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
77909
|
use strict; |
|
6
|
|
|
|
|
32
|
|
|
6
|
|
|
|
|
208
|
|
4
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
185
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
960
|
use Class::Utils qw(set_params); |
|
6
|
|
|
|
|
58791
|
|
|
6
|
|
|
|
|
206
|
|
7
|
6
|
|
|
6
|
|
163
|
use English; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
35
|
|
8
|
6
|
|
|
6
|
|
2912
|
use Error::Pure qw(err); |
|
6
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
275
|
|
9
|
6
|
|
|
6
|
|
3078
|
use Perl6::Slurp qw(slurp); |
|
6
|
|
|
|
|
9428
|
|
|
6
|
|
|
|
|
35
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.05; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
7
|
|
|
7
|
1
|
77794
|
my ($class, @params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Create object. |
17
|
7
|
|
|
|
|
18
|
my $self = bless {}, $class; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Version. |
20
|
7
|
|
|
|
|
43
|
$self->{'version'} = undef; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process parameters. |
23
|
7
|
|
|
|
|
33
|
set_params($self, @params); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Load file with versions. |
26
|
7
|
|
|
|
|
87
|
$self->{'_versions_file'} = $self->_versions_file; |
27
|
7
|
|
|
|
|
4401
|
my @versions = slurp($self->{'_versions_file'}, {'chomp' => 1}); |
28
|
7
|
|
|
|
|
1526
|
$self->{'_versions'} = \@versions; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Set version to last if isn't defined. |
31
|
7
|
100
|
|
|
|
26
|
if (! defined $self->{'version'}) { |
32
|
4
|
|
|
|
|
12
|
$self->{'version'} = $self->{'_versions'}->[-1]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
7
|
50
|
|
|
|
48
|
if ($self->{'version'} !~ /^([0-9]+)\.([0-9]+)\.([0-9]+)$/) { |
36
|
|
|
|
|
|
|
err 'Schema data version has bad format.', |
37
|
0
|
|
|
|
|
0
|
'Schema data version', $self->{'version'}, |
38
|
|
|
|
|
|
|
; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Load schema. |
42
|
7
|
|
|
|
|
43
|
$self->{'_schema_data_module'} = $class.'::'."$1\_$2\_$3"; |
43
|
7
|
|
|
|
|
392
|
eval 'require '.$self->{'_schema_data_module'}; |
44
|
7
|
50
|
|
|
|
122
|
if ($EVAL_ERROR) { |
45
|
|
|
|
|
|
|
err 'Cannot load Schema data module.', |
46
|
0
|
|
|
|
|
0
|
'Module name', $self->{'_schema_data_module'}, |
47
|
|
|
|
|
|
|
'Error', $EVAL_ERROR, |
48
|
|
|
|
|
|
|
; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
7
|
|
|
|
|
51
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub list_versions { |
55
|
1
|
|
|
1
|
1
|
9
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
12
|
return sort @{$self->{'_versions'}}; |
|
1
|
|
|
|
|
11
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub schema_data { |
61
|
2
|
|
|
2
|
1
|
13
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
16
|
return $self->{'_schema_data_module'}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub version { |
67
|
2
|
|
|
2
|
1
|
14
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
15
|
return $self->{'version'}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _versions_file { |
73
|
0
|
|
|
0
|
|
|
my $self = shift; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
err "We need to implement distribution file with Schema data versions."; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |