line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Schema::Data; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
65719
|
use strict; |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
144
|
|
4
|
6
|
|
|
6
|
|
25
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
135
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
815
|
use Class::Utils qw(set_params); |
|
6
|
|
|
|
|
49223
|
|
|
6
|
|
|
|
|
170
|
|
7
|
6
|
|
|
6
|
|
125
|
use English; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
24
|
|
8
|
6
|
|
|
6
|
|
2235
|
use Error::Pure qw(err); |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
235
|
|
9
|
6
|
|
|
6
|
|
2734
|
use Perl6::Slurp qw(slurp); |
|
6
|
|
|
|
|
7830
|
|
|
6
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.04; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
7
|
|
|
7
|
1
|
66032
|
my ($class, @params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Create object. |
17
|
7
|
|
|
|
|
15
|
my $self = bless {}, $class; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Version. |
20
|
7
|
|
|
|
|
22
|
$self->{'version'} = undef; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process parameters. |
23
|
7
|
|
|
|
|
24
|
set_params($self, @params); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Load file with versions. |
26
|
7
|
|
|
|
|
70
|
$self->{'_versions_file'} = $self->_versions_file; |
27
|
7
|
|
|
|
|
3657
|
my @versions = slurp($self->{'_versions_file'}, {'chomp' => 1}); |
28
|
7
|
|
|
|
|
1294
|
$self->{'_versions'} = \@versions; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Set version to last if isn't defined. |
31
|
7
|
100
|
|
|
|
24
|
if (! defined $self->{'version'}) { |
32
|
4
|
|
|
|
|
8
|
$self->{'version'} = $self->{'_versions'}->[-1]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
7
|
50
|
|
|
|
41
|
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
|
|
|
|
|
35
|
$self->{'_schema_data_module'} = $class.'::'."$1\_$2\_$3"; |
43
|
7
|
|
|
|
|
320
|
eval 'require '.$self->{'_schema_data_module'}; |
44
|
7
|
50
|
|
|
|
98
|
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
|
|
|
|
|
42
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub list_versions { |
55
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
8
|
return sort @{$self->{'_versions'}}; |
|
1
|
|
|
|
|
8
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub schema_data { |
61
|
2
|
|
|
2
|
1
|
12
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
12
|
return $self->{'_schema_data_module'}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub version { |
67
|
2
|
|
|
2
|
1
|
19
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
11
|
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__ |