Contacts/InternalTypes.pm

filter: Statementstmt 59.5% 25 / 42 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 30.7% 4 / 13 Podpod n/a totaltotal 49.2% 31 / 63 CC 5 SCAR 13.9
CC
5
Cov
54%
__ANON__
12.0
__ANON__
6.0
__ANON__
2.0
CRAP 4.0
« Contacts/Roles/CRUD.pm ↑ Summary Contacts/Photo.pm »
1 package WWW::Google::Contacts::InternalTypes;
2 {
3 20 $WWW::Google::Contacts::InternalTypes::VERSION = '0.39';
4 }
5  
6 20 ▶use MooseX::Types -declare => [
Subroutine BEGIN: called CC=1 SCAR=0.0
7 qw(
8 XmlBool
9 Rel
10 When
11 Where
12 Method
13 Country
14 YomiStr
15 )
16 20 ];
17  
18 20 ▶use MooseX::Types::Moose qw(Str Bool HashRef CodeRef Any);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 20 subtype Method, as CodeRef;
21  
22 0 ▶coerce Method, from Any, via {
Subroutine __ANON__: not called CC=1 SCAR=2.6
23 0 ▶ sub { return $_ }
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 };
25  
26 20 class_type Rel, { class => 'WWW::Google::Contacts::Type::Rel' };
27  
28 20 ▶coerce Rel, from Str, via {
Subroutine __ANON__: called CC=2 SCAR=6.9
29 20 require WWW::Google::Contacts::Type::Rel;
30 20 ▶ WWW::Google::Contacts::Type::Rel->new( ( $_ =~ m{^http} )
Branch: 1 branch
BranchTrueFalseTotal
$_ =~ /^http/ ? : 6 14 20
31 ? ( uri => $_ )
32 : ( name => $_ ),
33 );
34 20 };
35  
36 20 subtype XmlBool, as Bool;
37  
38 0 ▶coerce XmlBool, from Str, via {
Subroutine __ANON__: not called CC=2 SCAR=17.9
39 0 ▶ return 1 if ( $_ =~ m{^true$}i );
Branch: 1 branch
BranchTrueFalseTotal
if $_ =~ /^true$/i 0 0 0
40 0 return 0;
41 20 };
42  
43 20 class_type When, { class => 'WWW::Google::Contacts::Type::When' };
44  
45 0 ▶coerce When, from Str, via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 0 require WWW::Google::Contacts::Type::When;
47 0 WWW::Google::Contacts::Type::When->new( start_time => $_ );
48 0 ▶}, from HashRef, via {
Subroutine __ANON__: not called CC=3 SCAR=24.8
49 0 ▶ return undef unless defined $_->{startTime};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_->{"startTime"} 0 0 0
50 0 require WWW::Google::Contacts::Type::When;
51 WWW::Google::Contacts::Type::When->new(
52 start_time => $_->{startTime},
53 0 ▶ defined $_->{endTime} ? ( end_time => $_->{endTime} ) : (),
Branch: 1 branch
BranchTrueFalseTotal
defined $_->{'endTime'} ? : 0 0 0
54 );
55 20 };
56  
57 20 class_type Where, { class => 'WWW::Google::Contacts::Type::Where' };
58  
59 0 ▶coerce Where, from Str, via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 require WWW::Google::Contacts::Type::Where;
61 0 WWW::Google::Contacts::Type::Where->new( value => $_ );
62 0 ▶}, from HashRef, via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 0 require WWW::Google::Contacts::Type::Where;
64 0 WWW::Google::Contacts::Type::Where->new( value => $_->{valueString} );
65 20 };
66  
67 20 class_type Country, { class => 'WWW::Google::Contacts::Type::Country' };
68  
69 0 ▶coerce Country, from Str, via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
70 0 require WWW::Google::Contacts::Type::Country;
71 0 WWW::Google::Contacts::Type::Country->new( name => $_ );
72 0 ▶}, from HashRef, via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 0 require WWW::Google::Contacts::Type::Country;
74 0 WWW::Google::Contacts::Type::Country->new($_);
75 20 };
76  
77 20 subtype YomiStr, as Str;
78  
79 3 ▶coerce YomiStr, from HashRef, via {
Subroutine __ANON__: called CC=1 SCAR=0.0
80 3 $_->{content};
81 20 };
« Contacts/Roles/CRUD.pm ↑ Summary Contacts/Photo.pm »