| 1 | |||||||||||
| 2 | package XML::SRS::Date; | ||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use PRANG::Graph; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use MooseX::Method::Signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | BEGIN { | ||||||||||
| 10 | subtype "XML::SRS::Date::ymd" | ||||||||||
| 11 | => as "Str" | ||||||||||
| 12 | => where { | ||||||||||
| 13 | 0 | ▶ | m{^(\d{4})-(\d{1,2})-(\d{1,2})$}; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 2 | ▶ | }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.3
| |||||||||||
| 15 | |||||||||||
| 16 | subtype 'XML::SRS::Date::Year' | ||||||||||
| 17 | => as "Int", | ||||||||||
| 18 | => where { | ||||||||||
| 19 | 0 | ▶ | length(0+$_) == 4; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 20 | 2 | }; | |||||||||
| 21 | subtype 'XML::SRS::Date::Month' | ||||||||||
| 22 | => as "Int", | ||||||||||
| 23 | => where { | ||||||||||
| 24 | 0 | ▶ | $_ >= 1 and $_ <= 12; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 25 | 2 | }; | |||||||||
| 26 | subtype 'XML::SRS::Date::Day' | ||||||||||
| 27 | => as "Str", | ||||||||||
| 28 | => where { | ||||||||||
| 29 | 0 | ▶ | $_ >= 1 and $_ <= 31; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 30 | 2 | }; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 2 | has_attr 'year' => | |||||||||
| 34 | is => "rw", | ||||||||||
| 35 | isa => "XML::SRS::Number", | ||||||||||
| 36 | required => 1, | ||||||||||
| 37 | xml_name => "Year", | ||||||||||
| 38 | ; | ||||||||||
| 39 | |||||||||||
| 40 | 2 | has_attr 'month' => | |||||||||
| 41 | is => "rw", | ||||||||||
| 42 | isa => "XML::SRS::Number", | ||||||||||
| 43 | required => 1, | ||||||||||
| 44 | xml_name => "Month", | ||||||||||
| 45 | ; | ||||||||||
| 46 | |||||||||||
| 47 | 2 | has_attr 'day' => | |||||||||
| 48 | is => "rw", | ||||||||||
| 49 | isa => "XML::SRS::Number", | ||||||||||
| 50 | required => 1, | ||||||||||
| 51 | xml_name => "Day", | ||||||||||
| 52 | ; | ||||||||||
| 53 | |||||||||||
| 54 | 2 | ▶ | method buildargs_date($inv: XML::SRS::Date::ymd $ymd) { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
__ANON__: not called CC=1 SCAR=4.6
| |||||||||||
| 55 | 0 | my @buildargs; | |||||||||
| 56 | 0 | my ($y, $m, $d) = split "-", $ymd; | |||||||||
| 57 | 0 | push @buildargs, year => $y, month => $m, day => $d; | |||||||||
| 58 | 0 | @buildargs; | |||||||||
| 59 | 2 | } | |||||||||
| 60 | |||||||||||
| 61 | 2 | 1; | |||||||||