line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Java::Release::Obj; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
106448
|
use strict; |
|
14
|
|
|
|
|
92
|
|
|
14
|
|
|
|
|
428
|
|
4
|
14
|
|
|
14
|
|
79
|
use warnings; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
2385
|
|
5
|
|
|
|
|
|
|
|
6
|
14
|
|
|
14
|
|
5616
|
use Error::Pure qw(err); |
|
14
|
|
|
|
|
122370
|
|
|
14
|
|
|
|
|
434
|
|
7
|
14
|
|
|
14
|
|
9863
|
use List::MoreUtils qw(none); |
|
14
|
|
|
|
|
223340
|
|
|
14
|
|
|
|
|
88
|
|
8
|
14
|
|
|
14
|
|
23339
|
use Mo qw(default coerce is required); |
|
14
|
|
|
|
|
7441
|
|
|
14
|
|
|
|
|
83
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.06; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Computer architecture |
13
|
|
|
|
|
|
|
has arch => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Interim version. |
19
|
|
|
|
|
|
|
has interim => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Operating system. |
24
|
|
|
|
|
|
|
has os => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
required => 1, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Patch version. |
30
|
|
|
|
|
|
|
has patch => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Release version. |
35
|
|
|
|
|
|
|
has release => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
required => 1, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Update version. |
41
|
|
|
|
|
|
|
has update => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Version. |
46
|
|
|
|
|
|
|
sub version { |
47
|
20
|
|
|
20
|
1
|
29609
|
my ($self, $type) = @_; |
48
|
|
|
|
|
|
|
|
49
|
20
|
100
|
100
|
11
|
|
107
|
if ($type && none { $type eq $_ } qw(old new)) { |
|
11
|
|
|
|
|
53
|
|
50
|
1
|
|
|
|
|
5
|
err "Bad version type. Possible values are 'new' or 'old'.", |
51
|
|
|
|
|
|
|
'type', $type; |
52
|
|
|
|
|
|
|
} |
53
|
19
|
|
100
|
|
|
87
|
$type //= 'new'; |
54
|
|
|
|
|
|
|
|
55
|
19
|
|
|
|
|
49
|
my $version = $self->release; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Version like 'release'.'interim'.'update'.'patch' |
58
|
19
|
100
|
|
|
|
145
|
if ($type eq 'new') { |
59
|
12
|
100
|
|
|
|
26
|
if ($self->update) { |
60
|
9
|
100
|
|
|
|
59
|
if ($self->interim) { |
61
|
4
|
|
|
|
|
28
|
$version .= '.'.$self->interim; |
62
|
|
|
|
|
|
|
} else { |
63
|
5
|
|
|
|
|
34
|
$version .= '.0'; |
64
|
|
|
|
|
|
|
} |
65
|
9
|
|
|
|
|
37
|
$version .= '.'.$self->update; |
66
|
9
|
100
|
|
|
|
59
|
if ($self->patch) { |
67
|
1
|
|
|
|
|
7
|
$version .= '.'.$self->patch; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Version like 'release'u'update' |
72
|
|
|
|
|
|
|
} else { |
73
|
7
|
100
|
100
|
|
|
20
|
if ($self->interim || $self->patch) { |
74
|
2
|
|
|
|
|
22
|
err 'Cannot create old version of version with '. |
75
|
|
|
|
|
|
|
'interim or patch value.'; |
76
|
|
|
|
|
|
|
} |
77
|
5
|
100
|
|
|
|
73
|
if ($self->update) { |
78
|
4
|
|
|
|
|
29
|
$version .= 'u'.$self->update; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
17
|
|
|
|
|
166
|
return $version; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Version name. |
86
|
|
|
|
|
|
|
sub version_name { |
87
|
10
|
|
|
10
|
1
|
1819
|
my $self = shift; |
88
|
|
|
|
|
|
|
|
89
|
10
|
|
|
|
|
31
|
my $version_name = 'Java '.$self->release; |
90
|
10
|
100
|
|
|
|
85
|
if ($self->interim) { |
91
|
3
|
|
|
|
|
25
|
$version_name .= ' Major '.$self->interim; |
92
|
|
|
|
|
|
|
} |
93
|
10
|
100
|
|
|
|
76
|
if ($self->update) { |
94
|
7
|
|
|
|
|
45
|
$version_name .= ' Update '.$self->update; |
95
|
|
|
|
|
|
|
} else { |
96
|
3
|
|
|
|
|
24
|
$version_name .= ' GA'; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
10
|
|
|
|
|
80
|
return $version_name; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=pod |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=encoding utf8 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 NAME |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Java::Release::Obj - Data object for Java::Release. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 SYNOPSIS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
use Java::Release::Obj; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $obj = Java::Release::Obj->new(%params); |
119
|
|
|
|
|
|
|
my $arch = $obj->arch |
120
|
|
|
|
|
|
|
my $interim = $obj->interim; |
121
|
|
|
|
|
|
|
my $os = $obj->os; |
122
|
|
|
|
|
|
|
my $patch = $obj->patch; |
123
|
|
|
|
|
|
|
my $release = $obj->release; |
124
|
|
|
|
|
|
|
my $update = $obj->update; |
125
|
|
|
|
|
|
|
my $version = $obj->version($type); |
126
|
|
|
|
|
|
|
my $version_name = $obj->version_name; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 METHODS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 C<constructor> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $obj = Java::Release::Obj->new(%params); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Constructor. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns instance of object. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over 8 |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * C<arch> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Architecture. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Parameter is required. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * C<interim> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Interim version number. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Parameter is optional. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Default values is undef. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * C<os> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Operating system. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Parameter is required. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * C<patch> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Patch version number. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Parameter is optional. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Default values is undef. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * C<release> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Release version number. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Parameter is required. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item * C<update> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Update version number. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Parameter is optional. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Default values is undef. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=back |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 C<arch> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
my $arch = $obj->arch |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Get architecture. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Returns string. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 C<interim> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
my $interim = $obj->interim; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Get interim version number. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Returns integer. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 C<os> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
my $os = $obj->os; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Get operating system. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Returns string. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 C<patch> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
my $patch = $obj->patch; |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Get patch version number. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Returns integer. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 C<release> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
my $release = $obj->release; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Get release version number. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Returns integer. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head2 C<update> |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
my $update = $obj->update; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Get update version number. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Returns integer. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 C<version> |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
my $version = $obj->version($type); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Get version of release in short notation. There are two possibilities for C<$type>: 'new' (12.0.3) and 'old' (12u3) |
237
|
|
|
|
|
|
|
string. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns string. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head2 C<version_name> |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my $version_name = $obj->version_name; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Get version of release in character notation. There are two possibilities to write: new and old |
246
|
|
|
|
|
|
|
version. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Returns string. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 ERRORS |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
version(): |
253
|
|
|
|
|
|
|
Bad version type. Possible values are 'new' or 'old'. |
254
|
|
|
|
|
|
|
type: %s |
255
|
|
|
|
|
|
|
Cannot create old version of version with interim or patch value. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 EXAMPLE |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
use strict; |
260
|
|
|
|
|
|
|
use warnings; |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
use Data::Printer; |
263
|
|
|
|
|
|
|
use Java::Release::Obj; |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
my $obj = Java::Release::Obj->new( |
266
|
|
|
|
|
|
|
arch => 'i386', |
267
|
|
|
|
|
|
|
os => 'linux', |
268
|
|
|
|
|
|
|
release => 1, |
269
|
|
|
|
|
|
|
); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
p $obj; |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
# Output like: |
274
|
|
|
|
|
|
|
# Java::Release::Obj { |
275
|
|
|
|
|
|
|
# Parents Mo::Object |
276
|
|
|
|
|
|
|
# public methods (0) |
277
|
|
|
|
|
|
|
# private methods (0) |
278
|
|
|
|
|
|
|
# internals: { |
279
|
|
|
|
|
|
|
# arch "i386", |
280
|
|
|
|
|
|
|
# os "linux", |
281
|
|
|
|
|
|
|
# release 1 |
282
|
|
|
|
|
|
|
# } |
283
|
|
|
|
|
|
|
# } |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
L<Error::Pure>, |
288
|
|
|
|
|
|
|
L<List::MoreUtils>, |
289
|
|
|
|
|
|
|
L<Mo>. |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head1 REPOSITORY |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Java-Release> |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 AUTHOR |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
L<http://skim.cz> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
© 2020-2021 Michal Josef Špaček |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
BSD 2-Clause License |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head1 VERSION |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
0.06 |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=cut |