Sah/Schema/date/month_num.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_name/en.pm ↑ Summary Sah/Schema/date/month_nums.pm »
1 package Sah::Schema::date::month_num;
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 = [int => {
11 summary => 'Month number, coercible from English month names (Dec/DECEMBER), e.g. 2 or "Feb"',
12 min => 1,
13 max => 12,
14 'x.perl.coerce_rules' => ['From_str::convert_en_month_name_to_num'],
15 'x.completion' => ['date_month_num'],
16 description => <<'_',
17  
18 See also related schemas that coerce from other locales, e.g.
19 <pm:Sah::Schema::date::month_num::id> (Indonesian),
20 <pm:Sah::Schema::date::month_num::en_or_id> (English/Indonesian), etc.
21  
22 _
23 examples => [
24 {value=>'', valid=>0, summary=>"Empty string"},
25 {value=>0, valid=>0, summary=>"Not between 1-12"},
26 {value=>1, valid=>1},
27 {value=>"JUN", validated_value=>6, valid=>1},
28 {value=>12, valid=>1},
29 {value=>13, valid=>0, summary=>"Not between 1-12"},
30 ],
31 }];
32  
33 1 1;
34  
35 # ABSTRACT: Month number, coercible from English month names (Dec/DECEMBER), e.g. 2 or "Feb"
36  
37 __END__
« Sah/Schema/date/month_name/en.pm ↑ Summary Sah/Schema/date/month_nums.pm »