|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Data::Check::Structure;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $DATE = '2017-07-18'; # DATE  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '0.04'; # VERSION  | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
26830
 | 
 use strict;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
49
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #use warnings;  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
10
 | 
 use Exporter 'import';  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1419
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @EXPORT_OK = qw(  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_aoa  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_aoaos  | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_aoh  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_aohos  | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_aos  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_hoa  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_hoaos  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_hoh  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_hohos  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                        is_hos  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                );  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_aos {  | 
| 
24
 | 
15
 | 
 
 | 
 
 | 
  
15
  
 | 
  
1
  
 | 
673
 | 
     my ($data, $opts) = @_;  | 
| 
25
 | 
15
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
61
 | 
     $opts ||= {};  | 
| 
26
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
29
 | 
     my $max = $opts->{max};  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
15
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
55
 | 
     return 0 unless ref($data) eq 'ARRAY';  | 
| 
29
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
36
 | 
     for my $i (0..@$data-1) {  | 
| 
30
 | 
15
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
52
 | 
         last if defined($max) && $i >= $max;  | 
| 
31
 | 
14
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
50
 | 
         return 0 if ref($data->[$i]);  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
33
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
44
 | 
     1;  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_aoa {  | 
| 
37
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
1721
 | 
     my ($data, $opts) = @_;  | 
| 
38
 | 
4
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
20
 | 
     $opts ||= {};  | 
| 
39
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
     my $max = $opts->{max};  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     return 0 unless ref($data) eq 'ARRAY';  | 
| 
42
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     for my $i (0..@$data-1) {  | 
| 
43
 | 
8
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
28
 | 
         last if defined($max) && $i >= $max;  | 
| 
44
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
21
 | 
         return 0 unless ref($data->[$i]) eq 'ARRAY';  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
46
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     1;  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_aoaos {  | 
| 
50
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
1641
 | 
     my ($data, $opts) = @_;  | 
| 
51
 | 
4
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
21
 | 
     $opts ||= {};  | 
| 
52
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
     my $max = $opts->{max};  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     return 0 unless ref($data) eq 'ARRAY';  | 
| 
55
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     my $aos_opts = {max=>$max};  | 
| 
56
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     for my $i (0..@$data-1) {  | 
| 
57
 | 
8
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
31
 | 
         last if defined($max) && $i >= $max;  | 
| 
58
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
20
 | 
         return 0 unless is_aos($data->[$i], $aos_opts);  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
60
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     1;  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_aoh {  | 
| 
64
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
1675
 | 
     my ($data, $opts) = @_;  | 
| 
65
 | 
4
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
22
 | 
     $opts ||= {};  | 
| 
66
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     my $max = $opts->{max};  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
68
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
14
 | 
     return 0 unless ref($data) eq 'ARRAY';  | 
| 
69
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
     for my $i (0..@$data-1) {  | 
| 
70
 | 
8
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
31
 | 
         last if defined($max) && $i >= $max;  | 
| 
71
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
24
 | 
         return 0 unless ref($data->[$i]) eq 'HASH';  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
73
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     1;  | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
75
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
76
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_aohos {  | 
| 
77
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
1601
 | 
     my ($data, $opts) = @_;  | 
| 
78
 | 
4
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
23
 | 
     $opts ||= {};  | 
| 
79
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
     my $max = $opts->{max};  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
81
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
10
 | 
     return 0 unless ref($data) eq 'ARRAY';  | 
| 
82
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
     my $hos_opts = {max=>$max};  | 
| 
83
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     for my $i (0..@$data-1) {  | 
| 
84
 | 
8
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
27
 | 
         last if defined($max) && $i >= $max;  | 
| 
85
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
         return 0 unless is_hos($data->[$i], $hos_opts);  | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
87
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     1;  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_hos {  | 
| 
91
 | 
14
 | 
 
 | 
 
 | 
  
14
  
 | 
  
1
  
 | 
1891
 | 
     my ($data, $opts) = @_;  | 
| 
92
 | 
14
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
53
 | 
     $opts ||= {};  | 
| 
93
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
     my $max = $opts->{max};  | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
95
 | 
14
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
45
 | 
     return 0 unless ref($data) eq 'HASH';  | 
| 
96
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
     my $i = 0;  | 
| 
97
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
38
 | 
     for my $k (keys %$data) {  | 
| 
98
 | 
9
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
28
 | 
         last if defined($max) && ++$i >= $max;  | 
| 
99
 | 
9
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
40
 | 
         return 0 if ref($data->{$k});  | 
| 
100
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
101
 | 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
     1;  | 
| 
102
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
103
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
104
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_hoa {  | 
| 
105
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
1
  
 | 
1678
 | 
     my ($data, $opts) = @_;  | 
| 
106
 | 
3
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
26
 | 
     $opts ||= {};  | 
| 
107
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
     my $max = $opts->{max};  | 
| 
108
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
109
 | 
3
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     return 0 unless ref($data) eq 'HASH';  | 
| 
110
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     my $i = 0;  | 
| 
111
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     for my $k (keys %$data) {  | 
| 
112
 | 
2
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
11
 | 
         last if defined($max) && ++$i >= $max;  | 
| 
113
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
14
 | 
         return 0 unless ref($data->{$k}) eq 'ARRAY';  | 
| 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
115
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     1;  | 
| 
116
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
117
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
118
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_hoaos {  | 
| 
119
 | 
5
 | 
 
 | 
 
 | 
  
5
  
 | 
  
1
  
 | 
2625
 | 
     my ($data, $opts) = @_;  | 
| 
120
 | 
5
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
41
 | 
     $opts ||= {};  | 
| 
121
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
     my $max = $opts->{max};  | 
| 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
123
 | 
5
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
21
 | 
     return 0 unless ref($data) eq 'HASH';  | 
| 
124
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     my $i = 0;  | 
| 
125
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
     for my $k (keys %$data) {  | 
| 
126
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
20
 | 
         last if defined($max) && ++$i >= $max;  | 
| 
127
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
14
 | 
         return 0 unless is_aos($data->{$k});  | 
| 
128
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
129
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
     1;  | 
| 
130
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
131
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
132
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_hoh {  | 
| 
133
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
1
  
 | 
3241
 | 
     my ($data, $opts) = @_;  | 
| 
134
 | 
3
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
30
 | 
     $opts ||= {};  | 
| 
135
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     my $max = $opts->{max};  | 
| 
136
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
137
 | 
3
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     return 0 unless ref($data) eq 'HASH';  | 
| 
138
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
     my $i = 0;  | 
| 
139
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
     for my $k (keys %$data) {  | 
| 
140
 | 
2
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
11
 | 
         last if defined($max) && ++$i >= $max;  | 
| 
141
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
16
 | 
         return 0 unless ref($data->{$k}) eq 'HASH';  | 
| 
142
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
143
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     1;  | 
| 
144
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
145
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
146
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub is_hohos {  | 
| 
147
 | 
5
 | 
 
 | 
 
 | 
  
5
  
 | 
  
1
  
 | 
3050
 | 
     my ($data, $opts) = @_;  | 
| 
148
 | 
5
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
43
 | 
     $opts ||= {};  | 
| 
149
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     my $max = $opts->{max};  | 
| 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
151
 | 
5
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
23
 | 
     return 0 unless ref($data) eq 'HASH';  | 
| 
152
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     my $i = 0;  | 
| 
153
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     for my $k (keys %$data) {  | 
| 
154
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
20
 | 
         last if defined($max) && ++$i >= $max;  | 
| 
155
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
         return 0 unless is_hos($data->{$k});  | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
157
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
     1;  | 
| 
158
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
159
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
160
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
161
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: Check structure of data  | 
| 
162
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
163
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |