File Coverage

blib/lib/Parse/SAMGov/Exclusion/Name.pm
Criterion Covered Total %
statement 23 23 100.0
branch 6 12 50.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 35 41 85.3


line stmt bran cond sub pod time code
1             package Parse::SAMGov::Exclusion::Name;
2             $Parse::SAMGov::Exclusion::Name::VERSION = '0.105';
3 3     3   10 use strict;
  3         3  
  3         64  
4 3     3   6 use warnings;
  3         4  
  3         49  
5 3     3   45 use 5.010;
  3         7  
6 3     3   8 use Parse::SAMGov::Mo;
  3         3  
  3         18  
7              
8             #ABSTRACT: Defines the Name object that is used in the Exclusion
9              
10              
11             use overload
12             fallback => 1,
13             '""' => sub {
14 4     4   4 my $self = $_[0];
15 4 50       8 return $self->entity if length $self->entity;
16 4         5 my $str = '';
17 4 50       8 $str .= $self->prefix . ' ' if length $self->prefix;
18 4 50       8 $str .= $self->first if length $self->first;
19 4 50       7 $str .= ' ' . $self->middle if length $self->middle;
20 4 50       462 $str .= ' ' . $self->last if length $self->last;
21 4 50       7 $str .= ' ' . $self->suffix if length $self->suffix;
22 4         11 return $str;
23 3     3   12 };
  3         3  
  3         21  
24              
25             has 'entity';
26             has 'prefix';
27             has 'first';
28             has 'middle';
29             has 'last';
30             has 'suffix';
31              
32             1;
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Parse::SAMGov::Exclusion::Name - Defines the Name object that is used in the Exclusion
41              
42             =head1 VERSION
43              
44             version 0.105
45              
46             =head1 SYNOPSIS
47              
48             # use either for an individual or entity
49             my $name = Parse::SAMGov::Exclusion::Name->new(
50             prefix => 'Mr',
51             first => 'John',
52             middle => 'James',
53             last => 'Johnson',
54             suffix => 'Jr',
55             );
56             say "this is an individual" unless $name->entity;
57              
58             my $entity = Parse::SAMGov::Exclusion::Name->new(entity => 'ABC Corp Inc.');
59             say "this is an entity " if $name->entity;
60              
61             =head1 METHODS
62              
63             =head2 new
64              
65             Creates a new Name object for an individual or an entity but not both. If the
66             entity field is empty, it assumes the object represents an individual otherwise
67             the object represents an entity with the name in the entity field.
68              
69             =head2 entity
70              
71             Sets/gets the entity name. If the object represents an individual, this will be
72             undefined. If the object represents an entity this will be the name of the
73             entity.
74              
75             =head2 prefix
76              
77             Holds the prefix such as Mr,Ms,Mrs,Sir etc. for the name of the individual
78             being excluded.
79              
80             =head2 first
81              
82             Holds the first name of the individual being excluded.
83              
84             =head2 middle
85              
86             Holds the middle name of the individual being excluded.
87              
88             =head2 last
89              
90             Holds the last name of the individual being excluded.
91              
92             =head2 suffix
93              
94             Holds the suffix of the actual name of the person being excluded such as Jr, II,
95             III etc.
96              
97             =head1 AUTHOR
98              
99             Vikas N Kumar
100              
101             =head1 COPYRIGHT AND LICENSE
102              
103             This software is copyright (c) 2016 by Selective Intellect LLC.
104              
105             This is free software; you can redistribute it and/or modify it under
106             the same terms as the Perl 5 programming language system itself.
107              
108             =cut
109              
110             __END__