Contacts/Type/Name.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 97.3% 37 / 38 CC 2 SCAR 2.6
CC
2
Cov
97%
_full_name_set
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Contacts/Type/Base.pm ↑ Summary Contacts/Type/GroupMembership.pm »
1 package WWW::Google::Contacts::Type::Name;
2 {
3 19 $WWW::Google::Contacts::Type::Name::VERSION = '0.39';
4 }
5  
6 19 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 19 ▶use MooseX::Types::Moose qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 19 ▶use WWW::Google::Contacts::InternalTypes qw( YomiStr );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 19 ▶use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 19 extends 'WWW::Google::Contacts::Type::Base';
12  
13 19 has given_name => (
14 isa => YomiStr,
15 is => 'rw',
16 traits => ['XmlField'],
17 xml_key => 'gd:givenName',
18 predicate => 'has_given_name',
19 is_element => 1,
20 coerce => 1,
21 );
22  
23 19 has additional_name => (
24 isa => YomiStr,
25 is => 'rw',
26 traits => ['XmlField'],
27 xml_key => 'gd:additionalName',
28 predicate => 'has_additional_name',
29 is_element => 1,
30 coerce => 1,
31 );
32  
33 19 has family_name => (
34 isa => YomiStr,
35 is => 'rw',
36 traits => ['XmlField'],
37 xml_key => 'gd:familyName',
38 predicate => 'has_family_name',
39 is_element => 1,
40 coerce => 1,
41 );
42  
43 19 has name_prefix => (
44 isa => Str,
45 is => 'rw',
46 traits => ['XmlField'],
47 xml_key => 'gd:namePrefix',
48 predicate => 'has_name_prefix',
49 is_element => 1,
50 );
51  
52 19 has name_suffix => (
53 isa => Str,
54 is => 'rw',
55 traits => ['XmlField'],
56 xml_key => 'gd:nameSuffix',
57 predicate => 'has_name_suffix',
58 is_element => 1,
59 );
60  
61 19 has full_name => (
62 isa => YomiStr,
63 is => 'rw',
64 traits => ['XmlField'],
65 xml_key => 'gd:fullName',
66 predicate => 'has_full_name',
67 trigger => \&_full_name_set,
68 is_element => 1,
69 coerce => 1,
70 );
71  
72 4 ▶sub _full_name_set {
Subroutine _full_name_set: called CC=2 SCAR=7.0
73 4 my ( $self, $full_name ) = @_;
74  
75 # Try to be clever..
76 4 ▶ if ( $full_name =~ m{^([\w\-]+)\s+([\w\-]+)$} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($full_name =~ /^([\w\-]+)\s+([\w\-]+)$/) 4 0 4
77 4 $self->given_name($1);
78 4 $self->family_name($2);
79 }
80 }
81  
82 19 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 19 __PACKAGE__->meta->make_immutable;
84 19 1;
85 __END__
« Contacts/Type/Base.pm ↑ Summary Contacts/Type/GroupMembership.pm »