line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld::Target::Attribute::VersionList; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
11904
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
117
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
86
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use Carp; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
218
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
16
|
use parent qw/Enbld::Target::AttributeExtension::Word/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
21
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Enbld::Exception; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub initialize { |
13
|
54
|
|
|
54
|
0
|
115
|
my ( $self, $param ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
54
|
100
|
|
|
|
165
|
if ( ! defined $param ) { |
16
|
|
|
|
|
|
|
$self->{callback} = sub { |
17
|
35
|
|
|
35
|
|
53
|
my $attributes = shift; |
18
|
|
|
|
|
|
|
|
19
|
35
|
|
|
|
|
203
|
require Enbld::HTTP; |
20
|
35
|
|
|
|
|
195
|
my $html = Enbld::HTTP->get_html( $attributes->IndexSite ); |
21
|
35
|
|
|
|
|
202
|
my $list = $html->parse_version( |
22
|
|
|
|
|
|
|
$attributes->IndexParserForm, |
23
|
|
|
|
|
|
|
$attributes->VersionForm |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
35
|
|
|
|
|
162
|
return $list; |
27
|
48
|
|
|
|
|
358
|
}; |
28
|
|
|
|
|
|
|
|
29
|
48
|
|
|
|
|
148
|
return $self; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
6
|
100
|
|
|
|
11
|
if ( $param ) { |
33
|
5
|
|
|
|
|
20
|
$self->SUPER::initialize( $param ); |
34
|
5
|
|
|
|
|
6
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
1
|
my $err = "Attribute 'VersionList' isn't defined"; |
38
|
1
|
|
|
|
|
7
|
croak( Enbld::Exception->new( $err )); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub validate { |
42
|
40
|
|
|
40
|
0
|
59
|
my ( $self, $value ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
40
|
100
|
|
|
|
159
|
unless ( ref( $value ) eq 'ARRAY' ) { |
45
|
1
|
|
|
|
|
2
|
my $type = ref( $self ); |
46
|
1
|
|
|
|
|
4
|
$type =~ s/.*:://; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
1
|
my $err = "Attribute 'VersionList' isn't ARRAY reference"; |
49
|
1
|
|
|
|
|
4
|
croak( Enbld::Exception->new( $err, $value )); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
39
|
100
|
|
|
|
65
|
if ( ! @{ $value } ) { |
|
39
|
|
|
|
|
115
|
|
53
|
1
|
|
|
|
|
2
|
my $err = "Attribute 'VersionList' is no version list"; |
54
|
1
|
|
|
|
|
3
|
croak( Enbld::Exception->new( $err )); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
38
|
|
|
|
|
78
|
foreach my $string ( @{ $value } ) { |
|
38
|
|
|
|
|
109
|
|
58
|
74
|
|
|
|
|
220
|
$self->SUPER::validate( $string ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
37
|
|
|
|
|
52
|
return $value; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub to_value { |
65
|
40
|
|
|
40
|
0
|
56
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
40
|
|
|
|
|
181
|
my $value = $self->evaluate; |
68
|
|
|
|
|
|
|
|
69
|
40
|
|
|
|
|
118
|
$self->validate( $value ); |
70
|
|
|
|
|
|
|
|
71
|
37
|
|
|
|
|
124
|
return $value; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |