| 1 | |||||||||||
| 2 | package XML::SRS::Date; | ||||||||||
| 3 | 6 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | $XML::SRS::Date::VERSION = '0.09'; | |||||||||
| 5 | } | ||||||||||
| 6 | |||||||||||
| 7 | 6 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 6 | ▶ | use PRANG::Graph; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 6 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 6 | ▶ | use MooseX::Params::Validate; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 6 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||||||||||
| 13 | subtype "XML::SRS::Date::ymd" | ||||||||||
| 14 | => as "Str" | ||||||||||
| 15 | 0 | ▶ | => where { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 16 | 0 | m{^(\d{4})-(\d{1,2})-(\d{1,2})$}; | |||||||||
| 17 | 6 | }; | |||||||||
| 18 | |||||||||||
| 19 | subtype 'XML::SRS::Date::Year' | ||||||||||
| 20 | => as "Int", | ||||||||||
| 21 | 0 | ▶ | => where { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 22 | 0 | length(0+$_) == 4; | |||||||||
| 23 | 6 | }; | |||||||||
| 24 | subtype 'XML::SRS::Date::Month' | ||||||||||
| 25 | => as "Int", | ||||||||||
| 26 | 0 | ▶ | => where { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 27 | 0 | ▶ | $_ >= 1 and $_ <= 12; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 6 | }; | |||||||||
| 29 | subtype 'XML::SRS::Date::Day' | ||||||||||
| 30 | => as "Str", | ||||||||||
| 31 | 0 | ▶ | => where { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 32 | 0 | ▶ | $_ >= 1 and $_ <= 31; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 6 | }; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 6 | has_attr 'year' => | |||||||||
| 37 | is => "rw", | ||||||||||
| 38 | isa => "XML::SRS::Number", | ||||||||||
| 39 | required => 1, | ||||||||||
| 40 | xml_name => "Year", | ||||||||||
| 41 | ; | ||||||||||
| 42 | |||||||||||
| 43 | 6 | has_attr 'month' => | |||||||||
| 44 | is => "rw", | ||||||||||
| 45 | isa => "XML::SRS::Number", | ||||||||||
| 46 | required => 1, | ||||||||||
| 47 | xml_name => "Month", | ||||||||||
| 48 | ; | ||||||||||
| 49 | |||||||||||
| 50 | 6 | has_attr 'day' => | |||||||||
| 51 | is => "rw", | ||||||||||
| 52 | isa => "XML::SRS::Number", | ||||||||||
| 53 | required => 1, | ||||||||||
| 54 | xml_name => "Day", | ||||||||||
| 55 | ; | ||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub buildargs_date { | ||||||||
|
Subroutine
buildargs_date: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 58 | 0 | my $inv = shift; | |||||||||
| 59 | 0 | my ( $ymd ) = pos_validated_list( | |||||||||
| 60 | \@_, | ||||||||||
| 61 | { isa => 'XML::SRS::Date::ymd' }, | ||||||||||
| 62 | ); | ||||||||||
| 63 | |||||||||||
| 64 | 0 | my @buildargs; | |||||||||
| 65 | 0 | my ($y, $m, $d) = split "-", $ymd; | |||||||||
| 66 | 0 | push @buildargs, year => $y, month => $m, day => $d; | |||||||||
| 67 | 0 | @buildargs; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | sub date { | ||||||||
|
Subroutine
date: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 71 | 0 | my $self = shift; | |||||||||
| 72 | |||||||||||
| 73 | 0 | return sprintf( | |||||||||
| 74 | "%.4d-%.2d-%.2d", | ||||||||||
| 75 | $self->year, $self->month, $self->day, | ||||||||||
| 76 | ); | ||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 6 | 1; | |||||||||