line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld::Target::Attribute::Version; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
15654
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
117
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
97
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
16
|
use version; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
26
|
|
7
|
3
|
|
|
3
|
|
243
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
239
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
17
|
use parent qw/Enbld::Target::AttributeExtension::Word/; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub initialize { |
12
|
55
|
|
|
55
|
0
|
129
|
my ( $self, $param ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
55
|
100
|
|
|
|
188
|
if ( ! defined $param ) { |
15
|
|
|
|
|
|
|
$self->{callback} = sub { |
16
|
34
|
|
|
34
|
|
55
|
my $attributes = shift; |
17
|
|
|
|
|
|
|
|
18
|
34
|
|
|
|
|
209
|
my $list = $attributes->SortedVersionList; |
19
|
|
|
|
|
|
|
|
20
|
34
|
100
|
|
|
|
199
|
if ( $attributes->VersionCondition eq 'latest' ) { |
21
|
20
|
|
|
|
|
92
|
return $list->[-1]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
14
|
100
|
|
|
|
34
|
if ( grep { $attributes->VersionCondition eq $_ } @{ $list} ) { |
|
28
|
|
|
|
|
139
|
|
|
14
|
|
|
|
|
30
|
|
25
|
13
|
|
|
|
|
64
|
return $attributes->VersionCondition; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
6
|
my $err = "Invalid Version Condition:" . |
29
|
|
|
|
|
|
|
$attributes->VersionCondition . ", ". |
30
|
|
|
|
|
|
|
"please check install condition"; |
31
|
1
|
|
|
|
|
7
|
require Enbld::Error; |
32
|
1
|
|
|
|
|
8
|
croak( Enbld::Error->new( $err )); |
33
|
47
|
|
|
|
|
448
|
}; |
34
|
|
|
|
|
|
|
|
35
|
47
|
|
|
|
|
133
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
8
|
100
|
|
|
|
25
|
if ( $param ) { |
39
|
7
|
|
|
|
|
42
|
$self->SUPER::initialize( $param ); |
40
|
7
|
|
|
|
|
17
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
7
|
require Enbld::Exception; |
44
|
1
|
|
|
|
|
2
|
my $err = "Attribute 'Version' isn't defined"; |
45
|
1
|
|
|
|
|
7
|
croak( Enbld::Exception->new( $err )); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub validate { |
49
|
96
|
|
|
96
|
0
|
265
|
my ( $self, $string ) = @_; |
50
|
|
|
|
|
|
|
|
51
|
96
|
|
|
|
|
438
|
$self->SUPER::validate( $string ); |
52
|
|
|
|
|
|
|
|
53
|
93
|
|
|
|
|
644
|
my $form = $self->{attributes}->VersionForm; |
54
|
93
|
100
|
|
|
|
798
|
unless ( $string =~ /^$form$/ ) { |
55
|
1
|
|
|
|
|
3
|
my $err = 'Attribute Version is NOT valid version string.'; |
56
|
1
|
|
|
|
|
7
|
require Enbld::Exception; |
57
|
1
|
|
|
|
|
9
|
croak( Enbld::Exception->new( $err, $string )); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
92
|
|
|
|
|
369
|
return $string; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |