File Coverage

blib/lib/Parse/SAMGov/Entity/Address.pm
Criterion Covered Total %
statement 21 21 100.0
branch 10 10 100.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Parse::SAMGov::Entity::Address;
2             $Parse::SAMGov::Entity::Address::VERSION = '0.202';
3 6     6   333155 use strict;
  6         14  
  6         253  
4 6     6   31 use warnings;
  6         12  
  6         377  
5 6     6   110 use 5.010;
  6         18  
6 6     6   716 use Parse::SAMGov::Mo;
  6         13  
  6         62  
7              
8             #ABSTRACT: Defines the Address object of the entity.
9              
10              
11             use overload
12             fallback => 1,
13             '""' => sub {
14 107     107   316 my $str = '';
15 107 100       329 $str .= $_[0]->address . ', ' if length $_[0]->address;
16 107 100       311 $str .= $_[0]->city if length $_[0]->city;
17 107 100       321 $str .= ', ' . $_[0]->state if length $_[0]->state;
18 107 100       294 $str .= ', ' . $_[0]->country if length $_[0]->country;
19 107 100       277 $str .= ' - ' . $_[0]->zip if length $_[0]->zip;
20 107         442 return $str;
21 6     6   76 };
  6         53  
  6         101  
22              
23             has 'address';
24             has 'city';
25             has 'state';
26             has 'district';
27             has 'country';
28             has 'zip' => coerce => sub {
29             chop $_[0] if ($_[0] =~ /-$/);
30             return $_[0];
31             };
32              
33             1;
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Parse::SAMGov::Entity::Address - Defines the Address object of the entity.
42              
43             =head1 VERSION
44              
45             version 0.202
46              
47             =head1 SYNOPSIS
48              
49             my $addr = Parse::SAMGov::Entity::Address->new(
50             address => '123 Baker Street, Suite 1A',
51             city => 'Boringville',
52             state => 'ZB',
53             country => 'USA',
54             zip => '21900-1234',
55             );
56              
57             =head1 METHODS
58              
59             =head2 new
60              
61             Creates a new Address object for the entity or individual.
62              
63             =head2 address
64              
65             This fields holds the address information without the city/state/country and
66             postal/zip code.
67              
68             =head2 city
69              
70             The city name of the entity's address.
71              
72             =head2 state
73              
74             The state or province of the entity's address.
75              
76             =head2 district
77              
78             The congressional district number of the entity's address.
79              
80             =head2 country
81              
82             The three character country code for the entity's address.
83              
84             =head2 zip
85              
86             The zip or postal code of the entity's address.
87              
88             =head1 AUTHOR
89              
90             Vikas N Kumar <vikas@cpan.org>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2023 by Selective Intellect LLC.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut
100              
101             __END__
102             ### COPYRIGHT: Selective Intellect LLC.
103             ### AUTHOR: Vikas N Kumar <vikas@cpan.org>