SlimTimer/Types.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 96.6% 29 / 30 CC 2 SCAR 2.4
CC
2
Cov
96%
__ANON__
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« SlimTimer/TimeEntry.pm ↑ Summary SlimTimer/Task.pm »
1 # ABSTRACT: Defines Moose types used by WebService::SlimTimer.
2  
3 package WebService::SlimTimer::Types;
4  
5 4 ▶use DateTime::Format::RFC3339;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use MooseX::Types -declare => [qw(TimeStamp OptionalTimeStamp)];
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use MooseX::Types::Moose qw(Str Maybe);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub _DateTime_from_YAML
12 15 ▶{
Subroutine _DateTime_from_YAML: called CC=1 SCAR=0.0
13 # For some reason we have we get spaces between the date and time parts as
14 # well as before the time zone in the data returned by SlimTimer and we
15 # need to get rid of them before parsing as otherwise it fails.
16 15 s/ /T/; s/ //; DateTime::Format::RFC3339->parse_datetime($_)
17 }
18  
19 4 class_type TimeStamp, { class => 'DateTime' };
20 coerce TimeStamp,
21 from Str,
22 13 ▶ via { _DateTime_from_YAML($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
23  
24 4 subtype OptionalTimeStamp, as Maybe[TimeStamp];
25 coerce OptionalTimeStamp,
26 from Str,
27 2 ▶ via { defined $_ ? _DateTime_from_YAML($_) : undef };
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 2 0 2
28  
29  
30 __END__
« SlimTimer/TimeEntry.pm ↑ Summary SlimTimer/Task.pm »