Songkick/Types.pm

filter: Statementstmt 100% 14 / 14 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 20 / 20 CC 2 SCAR 3.4
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Songkick/Artist.pm ↑ Summary Songkick/MusicBrainz.pm »
1 =head1 NAME
2  
3 Net::Songkick::Types - Useful type stuff for Net::Songkick
4  
5 =head1 SYNOPSIS
6  
7 use Net::Songkick::Types;
8 # This really won't be very useful outside of Net::Songkick.
9  
10 =cut
11  
12 package Net::Songkick::Types;
13  
14 7 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 7 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 7 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 7 subtype 'Net::Songkick::DateTime',
19 as 'DateTime';
20  
21 coerce 'Net::Songkick::DateTime',
22 from 'HashRef',
23 4 ▶ via {
Subroutine __ANON__: called CC=2 SCAR=6.9
24 my $dt = $_->{datetime} ?
25  
26 DateTime::Format::Strptime->new(
27 pattern => '%Y-%m-%dT%H:%M:%S%z',
28 )->parse_datetime($_->{datetime}) :
29  
30 DateTime::Format::Strptime->new(
31 pattern => '%Y-%m-%d',
32 4 ▶ )->parse_datetime($_->{date}) ;
Branch: 1 branch
BranchTrueFalseTotal
$_->{'datetime'} ? : 3 1 4
33  
34 4 return $dt;
35 7 };
36  
37 7 1;
38  
39 =head1 AUTHOR
40  
41 Dave Cross <dave@perlhacks.com>
42  
43 =head1 SEE ALSO
44  
45 L<Net::Songkick>
46  
47 =head1 COPYRIGHT AND LICENSE
48  
49 Copyright (C) 2016, Magnum Solutions Ltd. All Rights Reserved.
50  
51 This script is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself.
53  
54 =cut
« Songkick/Artist.pm ↑ Summary Songkick/MusicBrainz.pm »