File Coverage

blib/lib/Business/PostNL/Data.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Business::PostNL::Data;
2 7     7   135 use strict;
  7         13  
  7         377  
3 7     7   9712 use base 'Exporter';
  7         20  
  7         1240  
4 7     7   48 use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
  7         14  
  7         1240  
5              
6 7     7   404 use Carp;
  7         220  
  7         4798  
7 7     7   9777 use YAML;
  7         116131  
  7         2808  
8              
9             $VERSION = 0.14;
10             @EXPORT = qw();
11             @EXPORT_OK = qw(zones table);
12             %EXPORT_TAGS = ("ALL" => [@EXPORT_OK]);
13              
14             =pod
15              
16             =head1 NAME
17              
18             Business::PostNL::Data - Shipping cost data for Business::PostNL
19              
20             =head1 DESCRIPTION
21              
22             Data module for Business::PostNL containing shipping cost
23             information, country zones etc.
24              
25             Nothing to see here, the show is over, move along please.
26              
27             =head2 METHODS
28              
29             The following methods are used and can be exported
30              
31             =head3 zones
32              
33             Returns a hashref with country and zone numbers
34              
35             =cut
36              
37             sub zones {
38 19     19 1 398 my %zones = (
39             0 => [ qw(NL) ], # NL
40             1 => [ qw(BE DK DE FR IT LU AT ES GB SE) ], # EU 1
41             2 => [ qw(BG EE FI HU IE HR LV LT PL PT RO SI SK CZ) ], # EU 2
42             3 => [ qw(AL AD BA IC CY FO GI GR GL IS LI MK MT MD
43             ME NO UA SM RS TR VA BY CH) ], # EU 3
44             );
45 19         39 my %z;
46 19         105 foreach my $key (keys %zones) {
47 76         121 foreach my $val (@{$zones{$key}}) {
  76         147  
48 912         3269 $z{$val} = $key;
49             }
50             }
51 19         145 return \%z;
52             }
53              
54             =pod
55              
56             =head3 table
57              
58             This method contains the heart of this module, the lookup table
59              
60             =cut
61              
62             sub table {
63 19     19 1 90 my $table = Load(<<'...');
64             ---
65             # Netherlands
66             netherlands:
67             # Letters (brievenbuspost)
68             small:
69             stamp:
70             '0,20': 0.64
71             '21,50': 1.28
72             '51,100': 1.92
73             '101,250': 2.56
74             '251,2000': 3.84
75             machine:
76             '0,20': 0.56
77             '21,50': 1.12
78             '51,100': 1.68
79             '101,250': 2.24
80             '251,2000': 3.36
81             # Parcels (paketten)
82             large:
83             stamp:
84             '0,10000': 6.75
85             '10001,30000': 12.90
86             machine:
87             '0,10000': 6.75
88             # Register (aangetekend)
89             register:
90             stamp:
91             '0,2000': 7.95
92             '2001,10000': 13.70
93             '10001,30000': 14.20
94             machine:
95             '0,2000': 7.71
96             '2001,10000': 8.05
97             # Outside of the Netherlands
98             world:
99             # letters
100             small:
101             # Within Europe (EU1 & EU2 & EU3)
102             europe:
103             stamp:
104             normal:
105             '0,20': 1.05
106             '21,50': 2.10
107             '51,100': 3.15
108             '101,250': 5.25
109             '251,2000': 9.45
110             register:
111             '0,2000': 11.00
112             machine:
113             normal:
114             '0,20': 1.02
115             '21,50': 2.04
116             '51,100': 3.06
117             '101,250': 5.09
118             '251,2000': 9.17
119             register:
120             '0,2000': 10.67
121             # Outside Europe
122             world:
123             stamp:
124             normal:
125             '0,20': 1.05
126             '21,50': 2.10
127             '51,100': 3.15
128             '101,250': 5.25
129             '251,2000': 9.45
130             register:
131             '0,2000': 16.00
132             machine:
133             normal:
134             '0,20': 1.02
135             '21,50': 2.04
136             '51,100': 3.06
137             '101,250': 5.09
138             '251,2000': 9.17
139             register:
140             '0,2000': 15.52
141             # parcels
142             large:
143             zone:
144             # EU1
145             1:
146             stamp:
147             normal:
148             '0,2000': 9.00
149             tracktrace:
150             '0,2000': 13.00
151             '2001,5000': 19.50
152             '5001,10000': 25.00
153             '10001,20000': 34.00
154             '20001,30000': 43.15
155             register:
156             '0,2000': 14.30
157             '2001,5000': 20.80
158             '5001,10000': 26.30
159             '10001,20000': 35.30
160             '20001,30000': 44.45
161             machine:
162             normal:
163             '0,2000': 8.73
164             tracktrace:
165             '0,2000': 13.00
166             '2001,5000': 19.50
167             '5001,10000': 25.00
168             '10001,20000': 34.00
169             register:
170             '0,2000': 14.30
171             '2001,5000': 20.80
172             '5001,10000': 26.30
173             '10001,20000': 35.30
174             # EU2
175             2:
176             stamp:
177             normal:
178             '0,2000': 11.00
179             tracktrace:
180             '0,2000': 18.50
181             '2001,5000': 25.00
182             '5001,10000': 31.00
183             '10001,20000': 40.00
184             '20001,30000': 50.40
185             register:
186             '0,2000': 19.80
187             '2001,5000': 26.30
188             '5001,10000': 32.30
189             '10001,20000': 41.30
190             '20001,30000': 51.70
191             machine:
192             normal:
193             '0,2000': 10.67
194             tracktrace:
195             '0,2000': 18.50
196             '2001,5000': 25.00
197             '5001,10000': 31.00
198             '10001,20000': 40.00
199             register:
200             '0,2000': 19.80
201             '2001,5000': 26.30
202             '5001,10000': 32.30
203             '10001,20000': 41.30
204             # EU3
205             3:
206             stamp:
207             normal:
208             '0,2000': 12.00
209             tracktrace:
210             '0,2000': 19.30
211             '2001,5000': 26.30
212             '5001,10000': 32.30
213             '10001,20000': 42.30
214             register:
215             '0,2000': 20.60
216             '2001,5000': 27.60
217             '5001,10000': 33.60
218             '10001,20000': 43.60
219             machine:
220             normal:
221             '0,2000': 11.64
222             tracktrace:
223             '0,2000': 19.30
224             '2001,5000': 26.30
225             '5001,10000': 32.30
226             '10001,20000': 42.30
227             register:
228             '0,2000': 20.60
229             '2001,5000': 27.60
230             '5001,10000': 33.60
231             '10001,20000': 43.60
232             # RoW
233             4:
234             stamp:
235             normal:
236             '0,2000': 18.00
237             tracktrace:
238             '0,2000': 24.30
239             '2001,5000': 34.30
240             '5001,10000': 58.30
241             '10001,20000': 105.30
242             register:
243             '0,2000': 25.60
244             '2001,5000': 35.60
245             '5001,10000': 59.60
246             '10001,20000': 106.60
247             machine:
248             normal:
249             '0,2000': 17.46
250             tracktrace:
251             '0,2000': 24.30
252             '2001,5000': 34.30
253             '5001,10000': 58.30
254             '10001,20000': 105.30
255             register:
256             '0,2000': 25.60
257             '2001,5000': 35.60
258             '5001,10000': 59.60
259             '10001,20000': 106.60
260             ...
261 19         2361346 return $table;
262             }
263              
264             =pod
265              
266             =head1 AUTHOR
267              
268             Menno Blom,
269             Eblom@cpan.orgE,
270             L
271              
272             =head1 COPYRIGHT
273              
274             This program is free software; you can redistribute
275             it and/or modify it under the same terms as Perl itself.
276              
277             The full text of the license can be found in the
278             LICENSE file included with this module.
279              
280             =head1 SEE ALSO
281              
282             L,
283             L
284              
285             =cut
286              
287             1;