| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Async::Webservice::DHL::Address; |
|
2
|
|
|
|
|
|
|
$Net::Async::Webservice::DHL::Address::VERSION = '1.2.1'; |
|
3
|
|
|
|
|
|
|
{ |
|
4
|
|
|
|
|
|
|
$Net::Async::Webservice::DHL::Address::DIST = 'Net-Async-Webservice-DHL'; |
|
5
|
|
|
|
|
|
|
} |
|
6
|
3
|
|
|
3
|
|
328621
|
use Moo; |
|
|
3
|
|
|
|
|
47671
|
|
|
|
3
|
|
|
|
|
16
|
|
|
7
|
3
|
|
|
3
|
|
4358
|
use 5.010; |
|
|
3
|
|
|
|
|
10
|
|
|
|
3
|
|
|
|
|
178
|
|
|
8
|
3
|
|
|
3
|
|
1791
|
use Types::Standard qw(Str Int Bool StrictNum); |
|
|
3
|
|
|
|
|
188349
|
|
|
|
3
|
|
|
|
|
45
|
|
|
9
|
3
|
|
|
3
|
|
4911
|
use Net::Async::Webservice::DHL::Types ':types'; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
33
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: an address for DHL |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
for my $l (1..3) { |
|
15
|
|
|
|
|
|
|
has "line$l" => ( |
|
16
|
|
|
|
|
|
|
is => 'ro', |
|
17
|
|
|
|
|
|
|
isa => Str, |
|
18
|
|
|
|
|
|
|
required => 0, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has city => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => Str, |
|
26
|
|
|
|
|
|
|
required => 0, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has division => ( |
|
31
|
|
|
|
|
|
|
is => 'ro', |
|
32
|
|
|
|
|
|
|
isa => Str, |
|
33
|
|
|
|
|
|
|
required => 0, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has postal_code => ( |
|
38
|
|
|
|
|
|
|
is => 'ro', |
|
39
|
|
|
|
|
|
|
isa => Str, |
|
40
|
|
|
|
|
|
|
required => 0, |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has country_code => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => CountryCode, |
|
47
|
|
|
|
|
|
|
required => 1, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has country_name => ( |
|
52
|
|
|
|
|
|
|
is => 'ro', |
|
53
|
|
|
|
|
|
|
isa => Str, |
|
54
|
|
|
|
|
|
|
required => 0, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
{ |
|
59
|
|
|
|
|
|
|
our $_self; |
|
60
|
|
|
|
|
|
|
sub _if { |
|
61
|
0
|
|
|
0
|
|
|
my ($method,$key) = @_; |
|
62
|
0
|
0
|
|
|
|
|
if ($_self->$method) { |
|
63
|
0
|
|
|
|
|
|
return ( $key => $_self->$method ); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
0
|
|
|
|
|
|
return; |
|
66
|
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub as_hash { |
|
69
|
0
|
|
|
0
|
1
|
|
my ($self,$shape) = @_; |
|
70
|
0
|
|
|
|
|
|
local $_self=$self; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if ($shape eq 'capability') { |
|
|
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return { |
|
74
|
0
|
|
|
|
|
|
_if(postal_code => 'Postalcode'), |
|
75
|
|
|
|
|
|
|
_if(city => 'City'), |
|
76
|
|
|
|
|
|
|
CountryCode => $self->country_code, |
|
77
|
|
|
|
|
|
|
}; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
elsif ($shape eq 'route') { |
|
80
|
|
|
|
|
|
|
return { |
|
81
|
0
|
|
|
|
|
|
_if(line1 => 'Address1'), |
|
82
|
|
|
|
|
|
|
_if(line2 => 'Address2'), |
|
83
|
|
|
|
|
|
|
_if(line3 => 'Address3'), |
|
84
|
|
|
|
|
|
|
_if(postal_code => 'PostalCode'), |
|
85
|
|
|
|
|
|
|
_if(city => 'City'), |
|
86
|
|
|
|
|
|
|
_if(division => 'Division'), |
|
87
|
|
|
|
|
|
|
CountryCode => $self->country_code, |
|
88
|
|
|
|
|
|
|
CountryName => '', # the value is required, but an empty |
|
89
|
|
|
|
|
|
|
# string will do |
|
90
|
|
|
|
|
|
|
_if(country_name => 'CountryName'), |
|
91
|
|
|
|
|
|
|
}; |
|
92
|
|
|
|
|
|
|
}; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=pod |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=encoding UTF-8 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 NAME |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Net::Async::Webservice::DHL::Address - an address for DHL |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 VERSION |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
version 1.2.1 |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 C<line1> |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 C<line2> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 C<line3> |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Address lines, all optional strings. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 C<city> |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
String with the name of the city, optional. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 C<division> |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Code of the division (e.g. state, prefecture, etc.), optional string. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 C<postal_code> |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
String with the post code of the address, optional. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 C<country_code> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
String with the 2 letter country code, required. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 C<country_name> |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
String with the full country name, required only for some uses. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 METHODS |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 C<as_hash> |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Returns a hashref that, when passed through L<XML::Compile>, will |
|
147
|
|
|
|
|
|
|
produce the XML fragment needed in DHL requests to represent this |
|
148
|
|
|
|
|
|
|
address. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Net-a-porter. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
159
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |