| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Amazon::MWS::XML::Address; |
|
2
|
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
35
|
use strict; |
|
|
7
|
|
|
|
|
10
|
|
|
|
7
|
|
|
|
|
253
|
|
|
4
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
208
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
579
|
use Moo; |
|
|
7
|
|
|
|
|
10142
|
|
|
|
7
|
|
|
|
|
80
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Amazon::MWS::XML::Address |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Class to handle the addresses in the Amazon MWS's XML responses. It |
|
15
|
|
|
|
|
|
|
provides some aliases to get a consistent interface. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=over 4 |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item Name |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Name of customer for this address. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=item AddressLine1 |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item AddressFieldOne |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item address1 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This is a field where Amazon stores the company name, or the c/o, or |
|
32
|
|
|
|
|
|
|
postal boxes, etc. It appears as the first line of the address, but |
|
33
|
|
|
|
|
|
|
you can't be sure what exactly it is (save you don't want to lose it). |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Sometimes the street address is here, sometimes is empty. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item AddressLine2 |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item AddressFieldTwo |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item address2 |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This appears to be the regular street/number address line, sometimes. |
|
44
|
|
|
|
|
|
|
Sometimes is in the address1. You just can't know, so you have to use |
|
45
|
|
|
|
|
|
|
some euristics, like checking if they are both set, otherwise choosing |
|
46
|
|
|
|
|
|
|
the first available to use as street address. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item PostalCode |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Postal code for this address. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item City |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
City for this address. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item Phone |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item PhoneNumber |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Phone number for this address. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item CountryCode |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item StateOrRegion |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has Phone => (is => 'ro'); |
|
72
|
|
|
|
|
|
|
has PhoneNumber => (is => 'ro'); |
|
73
|
|
|
|
|
|
|
has PostalCode => (is => 'ro'); |
|
74
|
|
|
|
|
|
|
has AddressLine1 => (is => 'ro'); |
|
75
|
|
|
|
|
|
|
has AddressFieldOne => (is => 'ro'); |
|
76
|
|
|
|
|
|
|
has AddressLine2 => (is => 'ro'); |
|
77
|
|
|
|
|
|
|
has AddressFieldTwo => (is => 'ro'); |
|
78
|
|
|
|
|
|
|
has StateOrRegion => (is => 'ro'); |
|
79
|
|
|
|
|
|
|
has City => (is => 'ro'); |
|
80
|
|
|
|
|
|
|
has Name => (is => 'ro'); |
|
81
|
|
|
|
|
|
|
has CountryCode => (is => 'ro'); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub name { |
|
84
|
8
|
|
|
8
|
1
|
33
|
return shift->Name; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub address1 { |
|
88
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
89
|
0
|
|
0
|
|
|
0
|
return $self->AddressLine1 || $self->AddressFieldOne || ''; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub address2 { |
|
93
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
94
|
0
|
|
0
|
|
|
0
|
return $self->AddressLine2 || $self->AddressFieldTwo || ''; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 ALIASES |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=over 4 |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item name (Name) |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item address_line |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Concatenation of address1 and address2. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item city (City) |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item zip (PostalCode) |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item country (CountryCode) |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item phone (Phone or PhoneNumber) |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item region (StateOrRegion) |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item state (StateOrRegion) |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub address_line { |
|
125
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
126
|
0
|
|
|
|
|
0
|
my $line = $self->address1; |
|
127
|
0
|
0
|
|
|
|
0
|
if (my $second = $self->address2) { |
|
128
|
0
|
0
|
|
|
|
0
|
if ($second ne $line) { |
|
129
|
0
|
|
|
|
|
0
|
$line .= "\n" . $second; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
} |
|
132
|
0
|
|
|
|
|
0
|
return $line; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub city { |
|
136
|
0
|
|
|
0
|
1
|
0
|
return shift->City; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub zip { |
|
140
|
0
|
|
|
0
|
1
|
0
|
return shift->PostalCode; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub country { |
|
144
|
0
|
|
|
0
|
1
|
0
|
return shift->CountryCode; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub phone { |
|
148
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
149
|
0
|
|
0
|
|
|
0
|
my $phone = $self->Phone || $self->PhoneNumber || ''; |
|
150
|
0
|
0
|
|
|
|
0
|
if (ref($phone) eq 'ARRAY') { |
|
151
|
0
|
|
|
|
|
0
|
return join(' ', map { $_->{_} } @$phone); |
|
|
0
|
|
|
|
|
0
|
|
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
else { |
|
154
|
0
|
|
|
|
|
0
|
return $phone; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub region { |
|
159
|
1
|
|
|
1
|
1
|
11
|
return shift->StateOrRegion; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub state { |
|
163
|
1
|
|
|
1
|
1
|
1312
|
return shift->StateOrRegion; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |