File Coverage

blib/lib/Parse/SAMGov/Entity/PointOfContact.pm
Criterion Covered Total %
statement 35 38 92.1
branch 17 28 60.7
condition 2 3 66.6
subroutine 7 8 87.5
pod 1 1 100.0
total 62 78 79.4


line stmt bran cond sub pod time code
1             package Parse::SAMGov::Entity::PointOfContact;
2             $Parse::SAMGov::Entity::PointOfContact::VERSION = '0.105';
3 3     3   10 use strict;
  3         3  
  3         87  
4 3     3   10 use warnings;
  3         4  
  3         48  
5 3     3   48 use 5.010;
  3         8  
6 3     3   11 use Parse::SAMGov::Mo;
  3         1  
  3         20  
7             extends 'Parse::SAMGov::Entity::Address';
8 3     3   1288 use Email::Valid;
  3         212022  
  3         627  
9              
10             #ABSTRACT: Defines the Point of Contact object of the entity.
11              
12              
13             use overload
14             fallback => 1,
15             '""' => sub {
16 92     92   69 my $str = '';
17 92 100 66     113 if (length $_[0]->first and length $_[0]->last) {
18 60         91 $str .= $_[0]->first;
19 60 100       91 $str .= ' ' . $_[0]->middle if length $_[0]->middle;
20 60         99 $str .= ' ' . $_[0]->last;
21 60 100       85 $str .= ', ' . $_[0]->title if length $_[0]->title;
22 60 50       89 $str .= ', ' . $_[0]->address if length $_[0]->address;
23 60 50       92 $str .= ', ' . $_[0]->city if length $_[0]->city;
24 60 50       88 $str .= ', ' . $_[0]->state if length $_[0]->state;
25 60 50       87 $str .= ', ' . $_[0]->country if length $_[0]->country;
26 60 50       88 $str .= ' - ' . $_[0]->zip if length $_[0]->zip;
27 60 50       97 $str .= '. Email: ' . $_[0]->email if $_[0]->email;
28 60 50       94 $str .= '. Phone: ' . $_[0]->phone if $_[0]->phone;
29 60 50       84 $str .= ' x' . $_[0]->phone_ext if $_[0]->phone_ext;
30 60 100       91 $str .= '. Fax: ' . $_[0]->fax if $_[0]->fax;
31 60 50       81 $str .= '. Phone(non-US): ' . $_[0]->phone_nonUS if $_[0]->phone_nonUS;
32 60         58 $str .= '.';
33             }
34 92         196 return $str;
35 3     3   19 };
  3         4  
  3         30  
36              
37             has 'first' => default => sub { '' };
38             has 'middle' => default => sub { '' };
39             has 'last' => default => sub { '' };
40             has 'title';
41             has 'phone';
42             has 'phone_ext';
43             has 'phone_nonUS';
44             has 'fax';
45             has 'email' => coerce => sub { Email::Valid->address($_[0]); };
46              
47             sub name {
48 0 0   0 1   if (length $_[0]->middle) {
49 0           return join(' ', $_[0]->first, $_[0]->middle, $_[0]->last);
50             } else {
51 0           return join(' ', $_[0]->first, $_[0]->last);
52             }
53             }
54              
55             1;
56              
57             =pod
58              
59             =encoding UTF-8
60              
61             =head1 NAME
62              
63             Parse::SAMGov::Entity::PointOfContact - Defines the Point of Contact object of the entity.
64              
65             =head1 VERSION
66              
67             version 0.105
68              
69             =head1 SYNOPSIS
70              
71             my $addr = Parse::SAMGov::Entity::PointOfContact->new(
72             first => 'John',
73             middle => 'F',
74             last => 'Jameson',
75             title => 'CEO',
76             address => '123 Baker Street, Suite 1A',
77             city => 'Boringville',
78             state => 'ZB',
79             country => 'USA',
80             zip => '21900-1234',
81             phone => '18888888888',
82             phone_ext => '101',
83             fax => '18887777777',
84             phone_nonUS => '442222222222',
85             email => 'abc@pqr.com',
86             );
87              
88             =head1 METHODS
89              
90             =head2 new
91              
92             Creates a new Point of Contact object for the entity or individual. This
93             inherits all the methods of the L object.
94              
95             =head2 first
96              
97             Get/Set the first name of the point of contact.
98              
99             =head2 middle
100              
101             Get/Set the middle initial of the point of contact.
102              
103             =head2 last
104              
105             Get/Set the last name of the point of contact.
106              
107             =head2 name
108              
109             Get the full name of the point of contact as a string.
110              
111             =head2 title
112              
113             Get/Set the title of the point of contact. Example is CEO, President, etc.
114              
115             =head2 phone
116              
117             Get/Set the U.S. Phone number of the point of contact.
118              
119             =head2 phone_ext
120              
121             Get/Set the U.S. Phone number extension of the point of contact if any.
122              
123             =head2 phone_nonUS
124              
125             Get/Set the non-U.S. phone number of the point of contact.
126              
127             =head2 fax
128              
129             Get/Set the fax number of the point of contact.
130              
131             =head2 email
132              
133             Get/Set the email of the point of contact.
134              
135             =head1 AUTHOR
136              
137             Vikas N Kumar
138              
139             =head1 COPYRIGHT AND LICENSE
140              
141             This software is copyright (c) 2016 by Selective Intellect LLC.
142              
143             This is free software; you can redistribute it and/or modify it under
144             the same terms as the Perl 5 programming language system itself.
145              
146             =cut
147              
148             __END__