| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# why name it BaseType instead of Base? because I'm sick of having 5 files named |
|
3
|
|
|
|
|
|
|
# Base.pm in my editor (there would be Type::Base and the various |
|
4
|
|
|
|
|
|
|
# Compiler::*::Type::Base). |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use 5.010; |
|
7
|
24
|
|
|
24
|
|
9773
|
use strict; |
|
|
24
|
|
|
|
|
74
|
|
|
8
|
24
|
|
|
24
|
|
104
|
use warnings; |
|
|
24
|
|
|
|
|
77
|
|
|
|
24
|
|
|
|
|
423
|
|
|
9
|
24
|
|
|
24
|
|
97
|
|
|
|
24
|
|
|
|
|
38
|
|
|
|
24
|
|
|
|
|
594
|
|
|
10
|
|
|
|
|
|
|
use Data::Sah::Util::Role 'has_clause'; |
|
11
|
24
|
|
|
24
|
|
843
|
use Role::Tiny; |
|
|
24
|
|
|
|
|
52
|
|
|
|
24
|
|
|
|
|
1027
|
|
|
12
|
24
|
|
|
24
|
|
140
|
#use Sah::Schema::Common; |
|
|
24
|
|
|
|
|
43
|
|
|
|
24
|
|
|
|
|
123
|
|
|
13
|
|
|
|
|
|
|
#use Sah::Schema::Sah; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
16
|
|
|
|
|
|
|
our $DATE = '2022-08-20'; # DATE |
|
17
|
|
|
|
|
|
|
our $DIST = 'Data-Sah'; # DIST |
|
18
|
|
|
|
|
|
|
our $VERSION = '0.912'; # VERSION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $sch_filter_elem = ['any', {of=>[ |
|
21
|
|
|
|
|
|
|
['str', {req=>1}], |
|
22
|
|
|
|
|
|
|
['array', {req=>1, len=>2, elems=>[ ['str',{req=>1}], ['hash',{req=>1}] ]}], |
|
23
|
|
|
|
|
|
|
]}]; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
requires 'handle_type'; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has_clause 'v', |
|
28
|
|
|
|
|
|
|
v => 2, |
|
29
|
|
|
|
|
|
|
prio => 0, |
|
30
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
31
|
|
|
|
|
|
|
schema => ['float'=>{req=>1, is=>1}], |
|
32
|
|
|
|
|
|
|
; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has_clause 'defhash_v', |
|
35
|
|
|
|
|
|
|
v => 2, |
|
36
|
|
|
|
|
|
|
prio => 0, |
|
37
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
38
|
|
|
|
|
|
|
schema => ['float'=>{req=>1, is=>1}], |
|
39
|
|
|
|
|
|
|
; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has_clause 'schema_v', |
|
42
|
|
|
|
|
|
|
v => 2, |
|
43
|
|
|
|
|
|
|
prio => 0, |
|
44
|
|
|
|
|
|
|
tags => ['meta'], |
|
45
|
|
|
|
|
|
|
schema => ['float'=>{req=>1}], |
|
46
|
|
|
|
|
|
|
; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has_clause 'base_v', |
|
49
|
|
|
|
|
|
|
v => 2, |
|
50
|
|
|
|
|
|
|
prio => 0, |
|
51
|
|
|
|
|
|
|
tags => ['meta'], |
|
52
|
|
|
|
|
|
|
schema => ['float'=>{req=>1}], |
|
53
|
|
|
|
|
|
|
; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has_clause 'ok', |
|
56
|
|
|
|
|
|
|
v => 2, |
|
57
|
|
|
|
|
|
|
tags => ['constraint'], |
|
58
|
|
|
|
|
|
|
prio => 1, |
|
59
|
|
|
|
|
|
|
schema => ['any', {}], |
|
60
|
|
|
|
|
|
|
allow_expr => 1, |
|
61
|
|
|
|
|
|
|
; |
|
62
|
|
|
|
|
|
|
has_clause 'default', |
|
63
|
|
|
|
|
|
|
v => 2, |
|
64
|
|
|
|
|
|
|
prio => 1, |
|
65
|
|
|
|
|
|
|
tags => ['default'], |
|
66
|
|
|
|
|
|
|
schema => ['any', {}], |
|
67
|
|
|
|
|
|
|
allow_expr => 1, |
|
68
|
|
|
|
|
|
|
attrs => { |
|
69
|
|
|
|
|
|
|
temp => { |
|
70
|
|
|
|
|
|
|
schema => [bool => {default=>0}], |
|
71
|
|
|
|
|
|
|
allow_expr => 0, |
|
72
|
|
|
|
|
|
|
}, |
|
73
|
|
|
|
|
|
|
}, |
|
74
|
|
|
|
|
|
|
; |
|
75
|
|
|
|
|
|
|
has_clause 'prefilters', |
|
76
|
|
|
|
|
|
|
v => 2, |
|
77
|
|
|
|
|
|
|
tags => ['filter'], |
|
78
|
|
|
|
|
|
|
prio => 10, |
|
79
|
|
|
|
|
|
|
schema => ['array' => {of=>$sch_filter_elem}], |
|
80
|
|
|
|
|
|
|
attrs => { |
|
81
|
|
|
|
|
|
|
temp => { |
|
82
|
|
|
|
|
|
|
}, |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
; |
|
85
|
|
|
|
|
|
|
has_clause 'default_lang', |
|
86
|
|
|
|
|
|
|
v => 2, |
|
87
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
88
|
|
|
|
|
|
|
prio => 2, |
|
89
|
|
|
|
|
|
|
schema => ['str'=>{req=>1, default=>'en_US'}], |
|
90
|
|
|
|
|
|
|
; |
|
91
|
|
|
|
|
|
|
has_clause 'name', |
|
92
|
|
|
|
|
|
|
v => 2, |
|
93
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
94
|
|
|
|
|
|
|
prio => 2, |
|
95
|
|
|
|
|
|
|
schema => ['str', {req=>1}], |
|
96
|
|
|
|
|
|
|
; |
|
97
|
|
|
|
|
|
|
has_clause 'summary', |
|
98
|
|
|
|
|
|
|
v => 2, |
|
99
|
|
|
|
|
|
|
prio => 2, |
|
100
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
101
|
|
|
|
|
|
|
schema => ['str', {req=>1}], |
|
102
|
|
|
|
|
|
|
; |
|
103
|
|
|
|
|
|
|
has_clause 'description', |
|
104
|
|
|
|
|
|
|
v => 2, |
|
105
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
106
|
|
|
|
|
|
|
prio => 2, |
|
107
|
|
|
|
|
|
|
schema => ['str', {req=>1}], |
|
108
|
|
|
|
|
|
|
; |
|
109
|
|
|
|
|
|
|
has_clause 'tags', |
|
110
|
|
|
|
|
|
|
v => 2, |
|
111
|
|
|
|
|
|
|
tags => ['meta', 'defhash'], |
|
112
|
|
|
|
|
|
|
prio => 2, |
|
113
|
|
|
|
|
|
|
schema => ['array', {of=>['str', {req=>1}, {}]}], |
|
114
|
|
|
|
|
|
|
; |
|
115
|
|
|
|
|
|
|
has_clause 'req', |
|
116
|
|
|
|
|
|
|
v => 2, |
|
117
|
|
|
|
|
|
|
tags => ['constraint'], |
|
118
|
|
|
|
|
|
|
prio => 3, |
|
119
|
|
|
|
|
|
|
schema => ['bool', {}], |
|
120
|
|
|
|
|
|
|
allow_expr => 1, |
|
121
|
|
|
|
|
|
|
; |
|
122
|
|
|
|
|
|
|
has_clause 'forbidden', |
|
123
|
|
|
|
|
|
|
v => 2, |
|
124
|
|
|
|
|
|
|
tags => ['constraint'], |
|
125
|
|
|
|
|
|
|
prio => 3, |
|
126
|
|
|
|
|
|
|
schema => ['bool', {}], |
|
127
|
|
|
|
|
|
|
allow_expr => 1, |
|
128
|
|
|
|
|
|
|
; |
|
129
|
|
|
|
|
|
|
has_clause 'if', |
|
130
|
|
|
|
|
|
|
v => 2, |
|
131
|
|
|
|
|
|
|
tags => ['constraint'], |
|
132
|
|
|
|
|
|
|
prio => 50, |
|
133
|
|
|
|
|
|
|
schema => ['array', {}], # XXX elems: [str|array|hash, str|array|hash, [ str|array|hash ]] |
|
134
|
|
|
|
|
|
|
allow_expr => 0, |
|
135
|
|
|
|
|
|
|
; |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#has_clause 'each', tags=>['constraint']; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
#has_clause 'check_each', tags=>['constraint']; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
#has_clause 'exists', tags=>['constraint']; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
#has_clause 'check_exists', tags=>['constraint']; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
#has_clause 'check', schema=>['sah::expr',{req=>1},{}], tags=>['constraint']; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
has_clause 'clause', |
|
148
|
|
|
|
|
|
|
v => 2, |
|
149
|
|
|
|
|
|
|
tags => ['constraint'], |
|
150
|
|
|
|
|
|
|
prio => 50, |
|
151
|
|
|
|
|
|
|
schema => ['array' => {req=>1, len=>2, elems => [ |
|
152
|
|
|
|
|
|
|
['sah::clname', {req=>1}], |
|
153
|
|
|
|
|
|
|
['any', {}], |
|
154
|
|
|
|
|
|
|
]}], |
|
155
|
|
|
|
|
|
|
; |
|
156
|
|
|
|
|
|
|
has_clause 'clset', |
|
157
|
|
|
|
|
|
|
v => 2, |
|
158
|
|
|
|
|
|
|
prio => 50, |
|
159
|
|
|
|
|
|
|
tags => ['constraint'], |
|
160
|
|
|
|
|
|
|
schema => ['sah::clset', {req=>1}], |
|
161
|
|
|
|
|
|
|
; |
|
162
|
|
|
|
|
|
|
has_clause 'postfilters', |
|
163
|
|
|
|
|
|
|
v => 2, |
|
164
|
|
|
|
|
|
|
tags => ['filter'], |
|
165
|
|
|
|
|
|
|
prio => 90, |
|
166
|
|
|
|
|
|
|
schema => ['array' => {req=>1, of=>$sch_filter_elem}], |
|
167
|
|
|
|
|
|
|
attrs => { |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
; |
|
170
|
|
|
|
|
|
|
has_clause 'examples', |
|
171
|
|
|
|
|
|
|
v => 2, |
|
172
|
|
|
|
|
|
|
tags => ['meta'], |
|
173
|
|
|
|
|
|
|
prio => 99, |
|
174
|
|
|
|
|
|
|
schema => ['array', {of=>['any', {}]}], # XXX non-hash or defhash with 'value' property specified |
|
175
|
|
|
|
|
|
|
; |
|
176
|
|
|
|
|
|
|
has_clause 'invalid_examples', |
|
177
|
|
|
|
|
|
|
v => 2, |
|
178
|
|
|
|
|
|
|
tags => ['meta'], |
|
179
|
|
|
|
|
|
|
prio => 99, |
|
180
|
|
|
|
|
|
|
schema => ['array', {of=>['any', {}]}], # XXX non-hash or defhash with 'value' property specified |
|
181
|
|
|
|
|
|
|
; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1; |
|
184
|
|
|
|
|
|
|
# ABSTRACT: Base type |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=pod |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=encoding UTF-8 |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 NAME |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Data::Sah::Type::BaseType - Base type |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 VERSION |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This document describes version 0.912 of Data::Sah::Type::BaseType (from Perl distribution Data-Sah), released on 2022-08-20. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=for Pod::Coverage ^(clause_.+|clausemeta_.+)$ |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 SOURCE |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah>. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 AUTHOR |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
|
217
|
|
|
|
|
|
|
GitHub. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
|
220
|
|
|
|
|
|
|
simply modify the code, then test via: |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
% prove -l |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
|
225
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
|
226
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
|
227
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
|
228
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
|
229
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
236
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 BUGS |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah> |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
243
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
244
|
|
|
|
|
|
|
feature. |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |