line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package Business::UPS::Tracking::Role::Builder; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
1
|
|
|
1
|
|
404
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
34
|
use 5.0100; |
|
1
|
|
|
|
|
2
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
#requires('xml'); |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4000
|
use Business::UPS::Tracking::Element::Address; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
11
|
1
|
|
|
1
|
|
528
|
use Business::UPS::Tracking::Element::Weight; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
12
|
1
|
|
|
1
|
|
510
|
use Business::UPS::Tracking::Element::ReferenceNumber; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
13
|
1
|
|
|
1
|
|
6
|
use Business::UPS::Tracking::Element::Code; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
214
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=encoding utf8 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Business::UPS::Tracking::Role::Builder - Helper role |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This role provides methods that construct various objects (eg. |
24
|
|
|
|
|
|
|
Business::UPS::Tracking::Element::Address). |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head3 build_address |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $address = $self->build_address($xpath_expression); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Turns an address xml node into a L<Business::UPS::Tracking::Element::Address> |
33
|
|
|
|
|
|
|
object. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub build_address { |
38
|
0
|
|
|
0
|
1
|
|
my ($self,$xpath) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $node = $self->xml->findnodes($xpath)->get_node(1); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return |
43
|
0
|
0
|
0
|
|
|
|
unless $node && ref $node; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return Business::UPS::Tracking::Element::Address->new( |
46
|
|
|
|
|
|
|
xml => $node, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head3 build_code |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $address = $self->build_code($xpath_expression); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Turns an address xml node into a L<Business::UPS::Tracking::Element::Address> |
55
|
|
|
|
|
|
|
object. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub build_code { |
61
|
0
|
|
|
0
|
1
|
|
my ($self,$xpath) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $node = $self->xml->findnodes($xpath)->get_node(1); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return |
66
|
0
|
0
|
0
|
|
|
|
unless $node && ref $node; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return Business::UPS::Tracking::Element::Code->new( |
69
|
|
|
|
|
|
|
xml => $node, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head3 build_weight |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $weight = $self->build_weight($xpath_expression); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Turns an weight xml node into a L<Business::UPS::Tracking::Element::Weight> |
78
|
|
|
|
|
|
|
object. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub build_weight { |
83
|
0
|
|
|
0
|
1
|
|
my ($self,$xpath) = @_; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my $node = $self->xml->findnodes($xpath)->get_node(1); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return |
88
|
0
|
0
|
0
|
|
|
|
unless $node && ref $node; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return Business::UPS::Tracking::Element::Weight->new( |
91
|
|
|
|
|
|
|
xml => $node, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head3 build_referencenumber |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my $weight = $self->build_referencenumber($xpath_expression); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Turns an weight xml node into a |
100
|
|
|
|
|
|
|
L<Business::UPS::Tracking::Element::ReferenceNumber> object. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub build_referencenumber { |
105
|
0
|
|
|
0
|
1
|
|
my ($self,$xpath) = @_; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $node = $self->xml->findnodes($xpath)->get_node(1); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
return |
110
|
0
|
0
|
0
|
|
|
|
unless $node && ref $node; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
return Business::UPS::Tracking::Element::ReferenceNumber->new( |
113
|
|
|
|
|
|
|
xml => $node, |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
1
|
|
5
|
no Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
118
|
|
|
|
|
|
|
1; |