| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::HTML::Element::Utils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
66
|
|
|
66
|
|
229381
|
use base qw(Exporter); |
|
|
66
|
|
|
|
|
156
|
|
|
|
66
|
|
|
|
|
15908
|
|
|
4
|
66
|
|
|
66
|
|
639
|
use strict; |
|
|
66
|
|
|
|
|
181
|
|
|
|
66
|
|
|
|
|
5260
|
|
|
5
|
66
|
|
|
66
|
|
397
|
use warnings; |
|
|
66
|
|
|
|
|
956
|
|
|
|
66
|
|
|
|
|
6615
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
66
|
|
|
66
|
|
36376
|
use Error::Pure qw(err); |
|
|
66
|
|
|
|
|
915074
|
|
|
|
66
|
|
|
|
|
2008
|
|
|
8
|
66
|
|
|
66
|
|
7368
|
use List::Util 1.33 qw(none); |
|
|
66
|
|
|
|
|
1668
|
|
|
|
66
|
|
|
|
|
10275
|
|
|
9
|
66
|
|
|
66
|
|
49903
|
use Mo::utils 0.06 qw(check_array); |
|
|
66
|
|
|
|
|
220209
|
|
|
|
66
|
|
|
|
|
1757
|
|
|
10
|
66
|
|
|
66
|
|
12821
|
use Readonly; |
|
|
66
|
|
|
|
|
143
|
|
|
|
66
|
|
|
|
|
27588
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Readonly::Array our @DATA_TYPES => qw(cb plain tags); |
|
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(check_data check_data_type); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 0.17; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub check_data { |
|
18
|
152
|
|
|
152
|
0
|
307831
|
my $self = shift; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Check data based on type. |
|
21
|
152
|
|
|
|
|
623
|
check_array($self, 'data'); |
|
22
|
147
|
|
|
|
|
1158
|
foreach my $data_item (@{$self->{'data'}}) { |
|
|
147
|
|
|
|
|
583
|
|
|
23
|
|
|
|
|
|
|
# Plain mode |
|
24
|
36
|
100
|
|
|
|
175
|
if ($self->{'data_type'} eq 'plain') { |
|
|
|
100
|
|
|
|
|
|
|
25
|
16
|
100
|
|
|
|
105
|
if (ref $data_item ne '') { |
|
26
|
5
|
|
|
|
|
32
|
err "Parameter 'data' in 'plain' mode must contain ". |
|
27
|
|
|
|
|
|
|
'reference to array with scalars.'; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Tags mode. |
|
31
|
|
|
|
|
|
|
} elsif ($self->{'data_type'} eq 'tags') { |
|
32
|
18
|
100
|
|
|
|
73
|
if (ref $data_item ne 'ARRAY') { |
|
33
|
5
|
|
|
|
|
25
|
err "Parameter 'data' in 'tags' mode must contain ". |
|
34
|
|
|
|
|
|
|
"reference to array with references ". |
|
35
|
|
|
|
|
|
|
'to array with Tags structure.'; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Callback. |
|
39
|
|
|
|
|
|
|
} else { |
|
40
|
2
|
100
|
|
|
|
11
|
if (ref $data_item ne 'CODE') { |
|
41
|
1
|
|
|
|
|
17
|
err "Parameter 'data' in 'cb' mode must contain ". |
|
42
|
|
|
|
|
|
|
"reference to code with callback."; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
136
|
|
|
|
|
334
|
return; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub check_data_type { |
|
51
|
154
|
|
|
154
|
0
|
265224
|
my $self = shift; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Check data type. |
|
54
|
154
|
100
|
|
|
|
632
|
if (! defined $self->{'data_type'}) { |
|
55
|
113
|
|
|
|
|
411
|
$self->{'data_type'} = 'plain'; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
154
|
100
|
|
330
|
|
1526
|
if (none { $self->{'data_type'} eq $_ } @DATA_TYPES) { |
|
|
330
|
|
|
|
|
3363
|
|
|
58
|
|
|
|
|
|
|
err "Parameter 'data_type' has bad value.", |
|
59
|
5
|
|
|
|
|
52
|
'Value', $self->{'data_type'}, |
|
60
|
|
|
|
|
|
|
; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
149
|
|
|
|
|
1903
|
return; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |