| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ============================================================================ |
|
2
|
|
|
|
|
|
|
package Business::UPS::Tracking::Element::Address; |
|
3
|
|
|
|
|
|
|
# ============================================================================ |
|
4
|
1
|
|
|
1
|
|
7
|
use utf8; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
1
|
|
|
1
|
|
35
|
use 5.0100; |
|
|
1
|
|
|
|
|
4
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6454
|
use Business::UPS::Tracking::Utils; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
276
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=encoding utf8 |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Business::UPS::Tracking::Element::Address - An address |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This class represents an address. Usually it is created |
|
20
|
|
|
|
|
|
|
automatically from a L<Business::UPS::Tracking::Shipment> object. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 xml |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Original L<XML::LibXML::Node> node. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 AddressLine1 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 AddressLine2 |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 AddressLine3 |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 City |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 StateProviceCode |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Only US and Canada |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 PostalCode |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 CountryCode |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
ISO 3166-1 alpha-2 country code. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has 'xml' => ( |
|
49
|
|
|
|
|
|
|
is => 'rw', |
|
50
|
|
|
|
|
|
|
isa => 'XML::LibXML::Node', |
|
51
|
|
|
|
|
|
|
required => 1, |
|
52
|
|
|
|
|
|
|
trigger => \&_build_address, |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
has 'AddressLine1' => ( |
|
55
|
|
|
|
|
|
|
is => 'rw', |
|
56
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
has 'AddressLine2' => ( |
|
59
|
|
|
|
|
|
|
is => 'rw', |
|
60
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
has 'AddressLine3' => ( |
|
63
|
|
|
|
|
|
|
is => 'rw', |
|
64
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
has 'City' => ( |
|
67
|
|
|
|
|
|
|
is => 'rw', |
|
68
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
has 'StateProvinceCode' => ( |
|
71
|
|
|
|
|
|
|
is => 'rw', |
|
72
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
has 'PostalCode' => ( |
|
75
|
|
|
|
|
|
|
is => 'rw', |
|
76
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
has 'CountryCode' => ( |
|
79
|
|
|
|
|
|
|
is => 'rw', |
|
80
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _build_address { |
|
84
|
0
|
|
|
0
|
|
|
my ( $self, $xml ) = @_; |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
foreach my $node ( @{ $xml->childNodes } ) { |
|
|
0
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $name = $node->nodeName; |
|
88
|
0
|
|
|
|
|
|
my $value = $node->textContent; |
|
89
|
0
|
0
|
|
|
|
|
next unless $self->can($name); |
|
90
|
0
|
0
|
|
|
|
|
next unless defined $value; |
|
91
|
0
|
|
|
|
|
|
$self->$name($value); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 printall |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Serialize address into a string. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 meta |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Moose meta method |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub printall { |
|
110
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my @address; |
|
113
|
0
|
0
|
|
|
|
|
push (@address,$self->AddressLine1) |
|
114
|
|
|
|
|
|
|
if $self->AddressLine1; |
|
115
|
0
|
0
|
|
|
|
|
push (@address,$self->AddressLine2) |
|
116
|
|
|
|
|
|
|
if $self->AddressLine2; |
|
117
|
0
|
0
|
|
|
|
|
push (@address,$self->AddressLine3) |
|
118
|
|
|
|
|
|
|
if $self->AddressLine3; |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
my $line = $self->CountryCode; |
|
121
|
0
|
0
|
|
|
|
|
$line .= '-'.$self->PostalCode |
|
122
|
|
|
|
|
|
|
if $self->PostalCode; |
|
123
|
0
|
0
|
|
|
|
|
$line .= ' '.$self->City |
|
124
|
|
|
|
|
|
|
if $self->City; |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
push (@address,$line); |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
return join("\n",@address); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
132
|
1
|
|
|
1
|
|
7
|
no Moose; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
133
|
|
|
|
|
|
|
1; |