Sah/Schema/date/month_nums.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 10 / 10 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Sah/Schema/date/month_num.pm ↑ Summary Sah/Schema/date/second.pm »
1 package Sah::Schema::date::month_nums;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
6 1 our $DATE = '2023-12-09'; # DATE
7 1 our $DIST = 'Sah-Schemas-Date'; # DIST
8 1 our $VERSION = '0.019'; # VERSION
9  
10 1 our $schema = ['array' => {
11 summary => 'Array of required month numbers (1-12, with coercions), e.g. [6,12]',
12 of => ['date::month_num', {req=>1}],
13 'x.perl.coerce_rules' => ['From_str::comma_sep'],
14 'x.completion' => ['date_month_num'],
15 description => <<'_',
16  
17 See also related schemas that coerce from other locales, e.g.
18 <pm:Sah::Schema::date::month_nums::id> (Indonesian),
19 <pm:Sah::Schema::date::month_nums::en_or_id> (English/Indonesian), etc.
20  
21 _
22 examples => [
23 {value=>'', valid=>1, validated_value=>[]},
24 {value=>0, valid=>0, summary=>'Has number not in 1-12'},
25 {value=>1, valid=>1, validated_value=>[1]},
26 {value=>[1], valid=>1},
27 {value=>[1,12], valid=>1},
28 {value=>[1,undef], valid=>0, summary=>'Contains undef'},
29 {value=>["Jan","JUN"], validated_value=>[1,6], valid=>1},
30 {value=>'January,JUNE', valid=>1, validated_value=>[1,6]},
31 {value=>[1,12,13], valid=>0, summary=>'Has number not in 1-12'},
32 {value=>'1,12,13', valid=>0, summary=>'Has number not in 1-12'},
33 ],
34 }];
35  
36 1 1;
37  
38 # ABSTRACT: Array of required month numbers (1-12, with coercions), e.g. [6,12]
39  
40 __END__
« Sah/Schema/date/month_num.pm ↑ Summary Sah/Schema/date/second.pm »