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.38';
4 }
5  
6 20 use MooseX::Types -declare => [
7 qw(
8 XmlBool
9 Rel
10 When
11 Where
12 Method
13 Country
14 YomiStr
15 )
16 20 ▶];
Subroutine BEGIN: called CC=1 SCAR=0.0
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 coerce Method, from Any, via {
23 0 ▶ sub { return $_ }
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 ▶};
Subroutine __ANON__: not called CC=1 SCAR=1.2
25  
26 20 class_type Rel, { class => 'WWW::Google::Contacts::Type::Rel' };
27  
28 coerce Rel, from Str, via {
29 20 ▶ require WWW::Google::Contacts::Type::Rel;
Subroutine __ANON__: called CC=2 SCAR=6.9
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 coerce XmlBool, from Str, via {
39 0 ▶ return 1 if ( $_ =~ m{^true$}i );
Subroutine __ANON__: not called CC=2 SCAR=17.9
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 coerce When, from Str, via {
46 0 ▶ require WWW::Google::Contacts::Type::When;
Subroutine __ANON__: not called CC=1 SCAR=6.9
47 0 WWW::Google::Contacts::Type::When->new( start_time => $_ );
48 }, from HashRef, via {
49 0 ▶ return undef unless defined $_->{startTime};
Subroutine __ANON__: not called CC=3 SCAR=24.8
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 coerce Where, from Str, via {
60 0 ▶ require WWW::Google::Contacts::Type::Where;
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 WWW::Google::Contacts::Type::Where->new( value => $_ );
62 }, from HashRef, via {
63 0 ▶ require WWW::Google::Contacts::Type::Where;
Subroutine __ANON__: not called CC=1 SCAR=6.9
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 coerce Country, from Str, via {
70 0 ▶ require WWW::Google::Contacts::Type::Country;
Subroutine __ANON__: not called CC=1 SCAR=6.9
71 0 WWW::Google::Contacts::Type::Country->new( name => $_ );
72 }, from HashRef, via {
73 0 ▶ require WWW::Google::Contacts::Type::Country;
Subroutine __ANON__: not called CC=1 SCAR=6.9
74 0 WWW::Google::Contacts::Type::Country->new($_);
75 20 };
76  
77 20 subtype YomiStr, as Str;
78  
79 coerce YomiStr, from HashRef, via {
80 3 ▶ $_->{content};
Subroutine __ANON__: called CC=1 SCAR=0.0
81 20 };
« Contacts/Roles/CRUD.pm ↑ Summary Contacts/Photo.pm »