line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
11
|
|
|
11
|
|
4516
|
|
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
314
|
|
4
|
|
|
|
|
|
|
use Data::Sah::Util::Role 'has_clause'; |
5
|
11
|
|
|
11
|
|
47
|
use Role::Tiny; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
388
|
|
6
|
11
|
|
|
11
|
|
73
|
|
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
51
|
|
7
|
|
|
|
|
|
|
requires 'superclause_has_elems'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has_clause 'max_len', |
10
|
|
|
|
|
|
|
v => 2, |
11
|
|
|
|
|
|
|
prio => 51, |
12
|
|
|
|
|
|
|
tags => ['constraint'], |
13
|
|
|
|
|
|
|
schema => ['int', {min=>0}], |
14
|
|
|
|
|
|
|
allow_expr => 1, |
15
|
|
|
|
|
|
|
code => sub { |
16
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
17
|
102
|
|
|
102
|
|
177
|
$self->superclause_has_elems('max_len', $cd); |
18
|
102
|
|
|
|
|
259
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has_clause 'min_len', |
21
|
|
|
|
|
|
|
v => 2, |
22
|
|
|
|
|
|
|
tags => ['constraint'], |
23
|
|
|
|
|
|
|
schema => ['int', {min=>0}], |
24
|
|
|
|
|
|
|
allow_expr => 1, |
25
|
|
|
|
|
|
|
code => sub { |
26
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
27
|
196
|
|
|
196
|
|
357
|
$self->superclause_has_elems('min_len', $cd); |
28
|
196
|
|
|
|
|
503
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has_clause 'len_between', |
31
|
|
|
|
|
|
|
v => 2, |
32
|
|
|
|
|
|
|
tags => ['constraint'], |
33
|
|
|
|
|
|
|
schema => ['array' => {req=>1, len=>2, elems => [ |
34
|
|
|
|
|
|
|
[int => {req=>1}], |
35
|
|
|
|
|
|
|
[int => {req=>1}], |
36
|
|
|
|
|
|
|
]}], |
37
|
|
|
|
|
|
|
allow_expr => 1, |
38
|
|
|
|
|
|
|
code => sub { |
39
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
40
|
60
|
|
|
60
|
|
128
|
$self->superclause_has_elems('len_between', $cd); |
41
|
60
|
|
|
|
|
192
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has_clause 'len', |
44
|
|
|
|
|
|
|
v => 2, |
45
|
|
|
|
|
|
|
tags => ['constraint'], |
46
|
|
|
|
|
|
|
schema => ['int', {min=>0}], |
47
|
|
|
|
|
|
|
allow_expr => 1, |
48
|
|
|
|
|
|
|
code => sub { |
49
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
50
|
192
|
|
|
192
|
|
341
|
$self->superclause_has_elems('len', $cd); |
51
|
192
|
|
|
|
|
518
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has_clause 'has', |
54
|
|
|
|
|
|
|
v => 2, |
55
|
|
|
|
|
|
|
tags => ['constraint'], |
56
|
|
|
|
|
|
|
schema => ['_same_elem', {req=>1}], |
57
|
|
|
|
|
|
|
inspect_elem => 1, |
58
|
|
|
|
|
|
|
prio => 55, # we should wait for clauses like e.g. 'each_elem' to coerce elements |
59
|
|
|
|
|
|
|
allow_expr => 1, |
60
|
|
|
|
|
|
|
code => sub { |
61
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
62
|
140
|
|
|
140
|
|
238
|
$self->superclause_has_elems('has', $cd); |
63
|
140
|
|
|
|
|
512
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has_clause 'each_index', |
66
|
|
|
|
|
|
|
v => 2, |
67
|
|
|
|
|
|
|
tags => ['constraint'], |
68
|
|
|
|
|
|
|
schema => ['sah::schema', {req=>1}], |
69
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
70
|
|
|
|
|
|
|
allow_expr => 0, |
71
|
|
|
|
|
|
|
code => sub { |
72
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
73
|
36
|
|
|
36
|
|
79
|
$self->superclause_has_elems('each_index', $cd); |
74
|
36
|
|
|
|
|
131
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has_clause 'each_elem', |
77
|
|
|
|
|
|
|
v => 2, |
78
|
|
|
|
|
|
|
tags => ['constraint'], |
79
|
|
|
|
|
|
|
schema => ['sah::schema', {req=>1}], |
80
|
|
|
|
|
|
|
inspect_elem => 1, |
81
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
82
|
|
|
|
|
|
|
allow_expr => 0, |
83
|
|
|
|
|
|
|
code => sub { |
84
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
85
|
67
|
|
|
67
|
|
119
|
$self->superclause_has_elems('each_elem', $cd); |
86
|
67
|
|
|
|
|
218
|
}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has_clause 'check_each_index', |
89
|
|
|
|
|
|
|
v => 2, |
90
|
|
|
|
|
|
|
tags => ['constraint'], |
91
|
|
|
|
|
|
|
schema => ['sah::schema', {req=>1}], |
92
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
93
|
|
|
|
|
|
|
allow_expr => 0, |
94
|
|
|
|
|
|
|
code => sub { |
95
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
96
|
0
|
|
|
0
|
|
|
$self->superclause_has_elems('check_each_index', $cd); |
97
|
0
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
has_clause 'check_each_elem', |
100
|
|
|
|
|
|
|
v => 2, |
101
|
|
|
|
|
|
|
tags => ['constraint'], |
102
|
|
|
|
|
|
|
schema => ['sah::schema', {req=>1}], |
103
|
|
|
|
|
|
|
inspect_elem => 1, |
104
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
105
|
|
|
|
|
|
|
allow_expr => 0, |
106
|
|
|
|
|
|
|
code => sub { |
107
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
108
|
0
|
|
|
0
|
|
|
$self->superclause_has_elems('check_each_elem', $cd); |
109
|
0
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
has_clause 'uniq', |
112
|
|
|
|
|
|
|
v => 2, |
113
|
|
|
|
|
|
|
tags => ['constraint'], |
114
|
|
|
|
|
|
|
schema => ['bool', {}], |
115
|
|
|
|
|
|
|
inspect_elem => 1, |
116
|
|
|
|
|
|
|
prio => 55, # we should wait for clauses like e.g. 'each_elem' to coerce elements |
117
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
118
|
|
|
|
|
|
|
allow_expr => 1, |
119
|
|
|
|
|
|
|
code => sub { |
120
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
121
|
0
|
|
|
0
|
|
|
$self->superclause_has_elems('uniq', $cd); |
122
|
0
|
|
|
|
|
|
}; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
has_clause 'exists', |
125
|
|
|
|
|
|
|
v => 2, |
126
|
|
|
|
|
|
|
tags => ['constraint'], |
127
|
|
|
|
|
|
|
schema => ['sah::schema', {req=>1}], |
128
|
|
|
|
|
|
|
inspect_elem => 1, |
129
|
|
|
|
|
|
|
subschema => sub { $_[0] }, |
130
|
|
|
|
|
|
|
allow_expr => 0, |
131
|
|
|
|
|
|
|
code => sub { |
132
|
|
|
|
|
|
|
my ($self, $cd) = @_; |
133
|
0
|
|
|
0
|
|
|
$self->superclause_has_elems('exists', $cd); |
134
|
0
|
|
|
|
|
|
}; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# has_prop 'len'; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# has_prop 'elems'; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# has_prop 'indices'; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
143
|
|
|
|
|
|
|
our $DATE = '2022-09-30'; # DATE |
144
|
|
|
|
|
|
|
our $DIST = 'Data-Sah'; # DIST |
145
|
|
|
|
|
|
|
our $VERSION = '0.913'; # VERSION |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |
148
|
|
|
|
|
|
|
# ABSTRACT: HasElems role |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=pod |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=encoding UTF-8 |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 NAME |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Data::Sah::Type::HasElems - HasElems role |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 VERSION |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This document describes version 0.913 of Data::Sah::Type::HasElems (from Perl distribution Data-Sah), released on 2022-09-30. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=for Pod::Coverage ^(clause_.+|clausemeta_.+)$ |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 HOMEPAGE |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SOURCE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah>. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 AUTHOR |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
181
|
|
|
|
|
|
|
GitHub. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
184
|
|
|
|
|
|
|
simply modify the code, then test via: |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
% prove -l |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
189
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
190
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
191
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
192
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
193
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
200
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 BUGS |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
207
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
208
|
|
|
|
|
|
|
feature. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |