Constants.pm

filter: Statementstmt 67.7% 42 / 62 Branchbran 27.2% 6 / 22 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 6 / 10 Podpod 100% 3 / 3 totaltotal 54.8% 57 / 104 CC 10 SCAR 26.2
CC
10
Cov
54%
_split_tag
30.0
uti_by_tt_carrier
20.0
field_name_to_tag
6.0
CRAP 13.7
« DirectConnect.pm ↑ Summary
1 # FedEx::Constants
2 # $Id: Constants.pm,v 1.17 2004/08/09 16:07:20 jay.powers Exp $
3 # Copyright (c) 2004 Jay Powers
4 # All rights reserved.
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the same terms as Perl itself
8 package Business::FedEx::Constants;
9  
10 1 require 5.006_000;
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 require Exporter;
15 1 require Tie::StrictHash;
16  
17 1 ▶use vars qw(@ISA @EXPORT $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 @ISA = ('Exporter');
20 1 @EXPORT = qw(
21 %FE_RE %FE_SE %FE_TT %FE_UTI_BY_TT %FE_RQ
22 $FE_RE $FE_SE $FE_TT $FE_RQ
23 field_name_to_tag
24 field_tag_to_name
25 uti_by_tt_carrier
26 );
27 1 $VERSION = '1.01';
28 }
29 1 ▶use vars grep { /^[$@%]/ } @EXPORT;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 # Here are all the UTI codes from FedEx
32 #1002 = 007 / 107 FDXG End-of-day close
33 #1005 = 023 / 123 FDXE FedEx Express Delete-A-Package
34 #2016 = 021 / 121 FDXE FedEx Express Ship-A-Package
35 #2017 = 022 / 122 FDXE Global Rate-A-Package
36 #2018 = 019 / 119 FDXE Service Availability
37 #2024 = 025 / 125 ALL Rate Available Services
38 #2025 = 410 / 510 ALL FedEx Locator
39 #3000 = 021 / 121 FDXG FedEx Ground Ship-A-Package
40 #3001 = 023 / 123 FDXG FedEx Ground Delete-A-Package
41 #3003 = 211 / 311 ALL Subscription
42 #3004 = 022 / 122 FDXG Global Rate-A-Package
43 #5000 = 402 / 502 ALL Track By Number, Destination, Ship Date, and Reference
44 #5001 = 405 / 505 ALL Signature Proof of Delivery
45 #5002 = 403 / 503 ALL Track By Number, Destination, Ship Date, and Reference
46 #
47 # XXX UTI 5000 isn't in the tagged transaction guide version 1.2
48 # (2003-07-10).
49  
50 1 our $FE_TT = {
51 1002 => ['007','FDXG'],
52 1005 => ['023','FDXE'],
53 2016 => ['021','FDXE'],
54 2017 => ['022','FDXE'],
55 2018 => ['019','FDXE'],
56 2024 => ['025',''],
57 2025 => ['410',''],
58 3000 => ['021','FDXG'],
59 3001 => ['023','FDXG'],
60 3003 => ['211',''],
61 3004 => ['022','FDXG'],
62 5000 => ['402',''],
63 5001 => ['405',''],
64 5002 => ['403','']
65 };
66  
67 # First check $FE_UTI_BY_TT->{$tt}{$carrier}, if that doesn't exist (you
68 # can use a simple boolean test), use $FE_UTI_BY_TT->{$tt}{''}.
69  
70 1 our $FE_UTI_BY_TT = { };
71 1 for my $uti (keys %{ $FE_TT }) {
72 14 my ($tt, $carrier) = @{ $FE_TT->{$uti} };
73 14 ▶ if (exists $FE_UTI_BY_TT->{$tt}{$carrier}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Business::FedEx::Constants::FE_UTI_BY_TT->{$tt}{$carrier}) 0 14 14
74 0 die "Duplicate %FE_TT entry for $tt/$carrier";
75 }
76 14 $FE_UTI_BY_TT->{$tt}{$carrier} = $uti;
77 }
78  
79 1 our $FE_RQ = {
80 1002 => [0,10,498,3025,1007,1366],
81 1005 => [0,10,498,3025,29],
82 2016 => [0,10,498,3025,4,32,5,7,8,9,117,183,13,18,50,68,23,1273,1401,1333],
83 2017 => [0,10,498,3025,8,9,117,16,17,50,75,1274,1401,1333],
84 2018 => [0,10,498,3025,47,9,17,50,24],
85 2024 => [0,10,498,8,9,117,16,17,50,1401,1333],
86 2025 => [0,10,498,3025,9],
87 3000 => [0,10,498,3025,4,32,5,7,8,9,117,183,13,18,50,68,23,1273,1401,1333],
88 3001 => [0,10,29,498,3025],
89 3003 => [0,10,4003,4008,4011,4012,4013,4014,4015],
90 5000 => [0,10,498,3025,24,29],
91 5001 => [0,10,498,3025,24,29],
92 5002 => [0,10,498,3025,24,29],
93 };
94  
95 1 our $FE_RE = {
96 0 => 'transaction_code',
97 1 => 'customer_transaction_identifier',
98 2 => 'transaction_error_code',
99 3 => 'transaction_error_message',
100 4 => 'sender_company',
101 5 => 'sender_address_line_1',
102 6 => 'sender_address_line_2',
103 7 => 'sender_city',
104 8 => 'sender_state',
105 9 => 'sender_postal_code',
106 10 => 'sender_fedex_express_account_number',
107 11 => 'recipient_company',
108 12 => 'recipient_contact_name',
109 13 => 'recipient_address_line_1',
110 14 => 'recipient_address_line_2',
111 15 => 'recipient_city',
112 16 => 'recipient_state',
113 17 => 'recipient_postal_code',
114 18 => 'recipient_phone_number',
115 20 => 'payer_account_number',
116 23 => 'pay_type',
117 24 => 'ship_date',
118 25 => 'reference_information',
119 27 => 'cod_flag',
120 28 => 'cod_return_tracking_number',
121 29 => 'tracking_number',
122 30 => 'ursa_code',
123 32 => 'sender_contact_name',
124 33 => 'service_commitment',
125 38 => 'sender_department',
126 40 => 'alcohol_type',
127 41 => 'alcohol_packaging',
128 44 => 'hal_address',
129 46 => 'hal_city',
130 47 => 'hal_state',
131 48 => 'hal_postal_code',
132 49 => 'hal_phone_number',
133 50 => 'recipient_country',
134 51 => 'signature_release_ok_flag',
135 52 => 'alcohol_packages',
136 57 => 'dim_height',
137 58 => 'dim_width',
138 59 => 'dim_length',
139 65 => 'astra_barcode',
140 66 => 'broker_name',
141 67 => 'broker_phone_number',
142 68 => 'customs_declared_value_currency_type',
143 70 => 'duties_pay_type',
144 71 => 'duties_payer_account',
145 72 => 'terms_of_sale',
146 73 => 'parties_to_transaction',
147 74 => 'country_of_ultimate_destination',
148 75 => 'weight_units',
149 76 => 'commodity_number_of_pieces',
150 79 => 'description_of_contents',
151 80 => 'country_of_manufacturer',
152 81 => 'harmonized_code',
153 82 => 'unit_quantity',
154 83 => 'export_license_number',
155 84 => 'export_license_expiration_date',
156 99 => 'end_of_record',
157 113 => 'commercial_invoice_flag',
158 116 => 'package_total',
159 117 => 'sender_country_code',
160 118 => 'recipient_irs',
161 120 => 'ci_marks_and_numbers',
162 169 => 'importer_country',
163 170 => 'importer_name',
164 171 => 'importer_company',
165 172 => 'importer_address_line_1',
166 173 => 'importer_address_line_2',
167 174 => 'importer_city',
168 175 => 'importer_state',
169 176 => 'importer_postal_code',
170 177 => 'importer_account_number',
171 178 => 'importer_number_phone',
172 180 => 'importer_id',
173 183 => 'sender_phone_number',
174 186 => 'cod_add_freight_charges_flag',
175 188 => 'label_buffer_data_stream',
176 190 => 'document_pib_shipment_flag',
177 194 => 'delivery_day',
178 195 => 'destination',
179 198 => 'destination_location_id',
180 404 => 'commodity_license_exception',
181 409 => 'delivery_date',
182 411 => 'cod_return_label_buffer_data_stream',
183 413 => 'nafta_flag',
184 414 => 'commodity_unit_of_measure',
185 418 => 'ci_comments',
186 431 => 'dim_weight_used_flag',
187 439 => 'cod_return_contact_name',
188 440 => 'residential_delivery_flag',
189 496 => 'freight_service_commitment',
190 498 => 'meter_number',
191 526 => 'form_id',
192 527 => 'cod_return_form_id',
193 528 => 'commodity_eccn',
194 535 => 'cod_return',
195 536 => 'cod_return_service_commitment',
196 543 => 'cod_return_collect_plus_freight_amount',
197 557 => 'message_type_code',
198 558 => 'message_code',
199 559 => 'message_text',
200 600 => 'forwarding_agent_routed_export_transaction_indicator',
201 602 => 'exporter_ein_ssn_indicator',
202 603 => 'int-con_company_name',
203 604 => 'int-con_contact_name',
204 605 => 'int-con_address_line_1',
205 606 => 'int-con_address_line_2',
206 607 => 'int-con_city',
207 608 => 'int-con_state',
208 609 => 'int-con_zip',
209 610 => 'int-con_phone_number',
210 611 => 'int-con_country',
211 1005 => 'manifest_invoic_e_file_name',
212 1006 => 'domain_name',
213 1007 => 'close_manifest_date',
214 1008 => 'package_ready_time',
215 1009 => 'time_companyclose',
216 1032 => 'duties_payer_country_code',
217 1089 => 'rate_scale',
218 1090 => 'rate_currency_type',
219 1092 => 'rate_zone',
220 1096 => 'origin_location_id',
221 1099 => 'volume_units',
222 1101 => 'payer_credit_card_number',
223 1102 => 'payer_credit_card_type',
224 1103 => 'sender_fax',
225 1104 => 'payer_credit_card_expiration_date',
226 1115 => 'ship_time',
227 1116 => 'dim_units',
228 1117 => 'package_sequence',
229 1118 => 'release_authorization_number',
230 1119 => 'future_day_shipment',
231 1120 => 'inside_pickup_flag',
232 1121 => 'inside_delivery_flag',
233 1123 => 'master_tracking_number',
234 1124 => 'master_form_id',
235 1137 => 'ursa_uned_prefix',
236 1139 => 'sender_irs_ein_number',
237 1145 => 'recipient_department',
238 1159 => 'scan_description',
239 1160 => 'scan_location_city',
240 1161 => 'scan_location_state',
241 1162 => 'scan_date',
242 1163 => 'scan_time',
243 1164 => 'scan_location_country',
244 1167 => 'disp_exception_cd',
245 1168 => 'status_exception_cd',
246 1174 => 'bso_flag',
247 1178 => 'ursa_suffix_code',
248 1179 => 'broker_fdx_account_number',
249 1180 => 'broker_company',
250 1181 => 'broker_line_1_address',
251 1182 => 'broker_line_2_address',
252 1183 => 'broker_city',
253 1184 => 'broker_state',
254 1185 => 'broker_postal_code',
255 1186 => 'broker_country_code',
256 1187 => 'broker_id_number',
257 1193 => 'ship_delete_message',
258 1195 => 'payer_country_code',
259 1200 => 'hold_at_location_hal_flag',
260 1201 => 'sender_email_address',
261 1202 => 'recipient_email_address',
262 1203 => 'optional_ship_alert_message',
263 1204 => 'ship_alert_email_address',
264 1206 => 'ship_alert_notification_flag',
265 1208 => 'no_indirect_delivery_flag_signature_required',
266 1210 => 'purpose_of_shipment',
267 1211 => 'pod_address',
268 1213 => 'proactive_notification_flag',
269 1237 => 'cod_return_phone',
270 1238 => 'cod_return_company',
271 1239 => 'cod_return_department',
272 1240 => 'cod_return_address_1',
273 1241 => 'cod_return_address_2',
274 1242 => 'cod_return_city',
275 1243 => 'cod_return_state',
276 1244 => 'cod_return_postal_code',
277 1253 => 'packaging_list_enclosed_flag',
278 1265 => 'hold_at_location_contact_name',
279 1266 => 'saturday_delivery_flag',
280 1267 => 'saturday_pickup_flag',
281 1268 => 'dry_ice_flag',
282 1271 => 'shippers_load_and_count_slac',
283 1272 => 'booking_number',
284 1273 => 'packaging_type',
285 1274 => 'service_type',
286 1286 => 'exporter_ppi-_contact_name',
287 1287 => 'exporter_ppi-company_name',
288 1288 => 'exporter_ppi-address_line_1',
289 1289 => 'exporter_ppi-address_line_2',
290 1290 => 'exporter_ppi-city',
291 1291 => 'exporter_ppi-state',
292 1292 => 'exporter_ppi-zip',
293 1293 => 'exporter_ppi-country',
294 1294 => 'exporter_ppi-phone_number',
295 1295 => 'exporter_ppi-ein_ssn',
296 1297 => 'customer_invoice_number',
297 1300 => 'purchase_order_number',
298 1331 => 'dangerous',
299 1332 => 'alcohol_flag',
300 1333 => 'drop_off_type',
301 1337 => 'package_content_information',
302 1339 => 'estimated_delivery_date',
303 1340 => 'estimated_delivery_time',
304 1341 => 'sender_pager_number',
305 1342 => 'recipient_pager_number',
306 1343 => 'broker_email_address',
307 1344 => 'broker_fax_number',
308 1346 => 'emerge_shipment_identifier',
309 1347 => 'emerge_merchant_identifier',
310 1349 => 'aes_filing_status',
311 1350 => 'xtn_suffix_number',
312 1352 => 'sender_ein_ssn_identificator',
313 1358 => 'aes_ftsr_exemption_number',
314 1359 => 'sed_legend_number',
315 1366 => 'close_manifest_time',
316 1367 => 'close_manifest_data_buffer',
317 1368 => 'label_type',
318 1369 => 'label_printer_type',
319 1370 => 'label_media_type',
320 1371 => 'manifest_only_request_flag',
321 1372 => 'manifest_total',
322 1376 => 'rate_weight_unit_of_measure',
323 1377 => 'dim_weight_unit_of_measure',
324 1391 => 'client_revision_indicator',
325 1392 => 'inbound_visibility_block_shipment_data_indicator',
326 1394 => 'shipment_content_records_total',
327 1395 => 'part_number',
328 1396 => 'sku_item_upc',
329 1397 => 'receive_quantity',
330 1398 => 'description',
331 1399 => 'aes_entry_number',
332 1400 => 'total_shipment_weight',
333 1401 => 'total_package_weight',
334 1402 => 'billed_weight',
335 1403 => 'dim_weight',
336 1404 => 'total_volume',
337 1405 => 'alcohol_volume',
338 1406 => 'dry_ice_weight',
339 1407 => 'commodity_weight',
340 1408 => 'commodity_unit_value',
341 1409 => 'cod_amount',
342 1410 => 'commodity_customs_value',
343 1411 => 'total_customs_value',
344 1412 => 'freight_charge',
345 1413 => 'insurance_charge',
346 1414 => 'taxes_miscellaneous_charge',
347 1415 => 'declared_value_carriage_value',
348 1416 => 'base_rate_amount',
349 1417 => 'total_surcharge_amount',
350 1418 => 'total_discount_amount',
351 1419 => 'net_charge_amount',
352 1420 => 'total_rebate_amount',
353 1429 => 'list_variable_handling_charge_amount',
354 1431 => 'list_total_customer_charge',
355 1432 => 'cod_customer_amount',
356 1450 => 'more_data_indicator',
357 1451 => 'sequence_number',
358 1452 => 'last_tracking_number',
359 1453 => 'track_reference_type',
360 1454 => 'track_reference',
361 1456 => 'spod_type_request',
362 1458 => 'spod_fax_recipient_name',
363 1459 => 'spod_fax_recipient_number',
364 1460 => 'spod_fax_sender_name',
365 1461 => 'spod_fax_sender_phone_number',
366 1462 => 'language_indicator',
367 1463 => 'spod_fax_recipient_company_name_mail',
368 1464 => 'spod_fax_recipient_address_line_1_mail',
369 1465 => 'spod_fax_recipient_address_line_2_mail',
370 1466 => 'spod_fax_recipient_city_mail',
371 1467 => 'spod_fax_recipient_state_mail',
372 1468 => 'spod_fax_recipient_zip_postal_code_mail',
373 1469 => 'spod_fax_recipient_country_mail',
374 1470 => 'spod_fax_confirmation',
375 1471 => 'spod_letter',
376 1472 => 'spod_ground_recipient_name',
377 1473 => 'spod_ground_recipient_company_name',
378 1474 => 'spod_ground_recipient_address_line_1',
379 1475 => 'spod_ground_recipient_address_line_2',
380 1476 => 'spod_ground_recipient_city',
381 1477 => 'spod_ground_recipient_state_province',
382 1478 => 'spod_ground_recipient_zip_postal_code',
383 1479 => 'spod_ground_recipient_country',
384 1480 => 'more_information',
385 1507 => 'list_total_surcharge_amount',
386 1525 => 'effective_net_discount',
387 1528 => 'list_net_charge_amount',
388 1529 => 'rate_indicator_1_numeric_valid_values',
389 1530 => 'list_base_rate_amount',
390 1531 => 'list_total_discount_amount',
391 1532 => 'list_total_rebate_amount',
392 1534 => 'detail_scan_indicator',
393 1535 => 'paging_token',
394 1536 => 'number_of_relationships',
395 1537 => 'search_relationship_string',
396 1538 => 'search_relationship_type_code',
397 1551 => 'delivery_notification_flag',
398 1552 => 'language_code',
399 1553 => 'shipper_delivery_notification_flag',
400 1554 => 'shipper_ship_alert_flag',
401 1555 => 'shipper_language_code',
402 1556 => 'recipient_delivery_notification_flag',
403 1557 => 'recipient_ship_alert_flag',
404 1558 => 'recipient_language_code',
405 1559 => 'broker_delivery_notification_flag',
406 1560 => 'broker_ship_alert_flag',
407 1561 => 'broker_language_code',
408 1562 => 'fedex_staffed_location_flag',
409 1563 => 'fedex_self_service_location_indicator',
410 1564 => 'fasc',
411 1565 => 'latest_express_dropoff_flag',
412 1566 => 'express_dropoff_after_time',
413 1567 => 'fedex_location_intersection_street_address',
414 1568 => 'distance',
415 1569 => 'hours_of_operation',
416 1570 => 'hours_of_operation_sat',
417 1571 => 'last_express_dropoff',
418 1572 => 'last_express_dropoff_sat',
419 1573 => 'express_service_flag',
420 1574 => 'location_count',
421 1575 => 'fedex_location_business_name',
422 1576 => 'fedex_location_business_type',
423 1577 => 'fedex_location_city',
424 1578 => 'fedex_location_state',
425 1579 => 'fedex_location_postal_code',
426 1580 => 'dangerous_goods_flag',
427 1581 => 'saturday_service_flag',
428 1582 => 'begin_date',
429 1583 => 'end_date',
430 1584 => 'tracking_groups',
431 1606 => 'variable_handling_charge_level',
432 1607 => 'doc_tab_header_1',
433 1608 => 'doc_tab_header_2',
434 1609 => 'doc_tab_header_3',
435 1610 => 'doc_tab_header_4',
436 1611 => 'doc_tab_header_5',
437 1612 => 'doc_tab_header_6',
438 1613 => 'doc_tab_header_7',
439 1614 => 'doc_tab_header_8',
440 1615 => 'doc_tab_header_9',
441 1616 => 'doc_tab_header_10',
442 1617 => 'doc_tab_header_11',
443 1618 => 'doc_tab_header_12',
444 1624 => 'doc_tab_field_1',
445 1625 => 'doc_tab_field_2',
446 1626 => 'doc_tab_field_3',
447 1627 => 'doc_tab_field_4',
448 1628 => 'doc_tab_field_5',
449 1629 => 'doc_tab_field_6',
450 1630 => 'doc_tab_field_7',
451 1631 => 'doc_tab_field_8',
452 1632 => 'doc_tab_field_9',
453 1633 => 'doc_tab_field_10',
454 1634 => 'doc_tab_field_11',
455 1635 => 'doc_tab_field_12',
456 1636 => 'delivery_area_surcharge',
457 1637 => 'list_delivery_area_surcharge',
458 1638 => 'fuel_surcharge',
459 1639 => 'list_fuel_surcharge',
460 1640 => 'fice_surcharge',
461 1642 => 'value_added_tax',
462 1644 => 'offshore_surcharge',
463 1645 => 'list_offshore_surcharge',
464 1649 => 'other_surcharges',
465 1650 => 'list_other_surcharges',
466 1704 => 'service_type_description',
467 1705 => 'deliver_to',
468 1706 => 'signed_for',
469 1707 => 'delivery_time',
470 1711 => 'status_exception',
471 1713 => 'tracking_cod_flag',
472 1715 => 'number_of_track_activities',
473 1716 => 'delivery_reattempt_date',
474 1717 => 'delivery_reattempt_time',
475 1718 => 'package_type_description',
476 1720 => 'delivery_date_numeric',
477 1721 => 'tracking_activity_line_1',
478 1722 => 'tracking_activity_line_2',
479 1723 => 'tracking_activity_line_3',
480 1724 => 'tracking_activity_line_4',
481 1725 => 'tracking_activity_line_5',
482 1726 => 'tracking_activity_line_6',
483 1727 => 'tracking_activity_line_7',
484 1728 => 'tracking_activity_line_8',
485 1729 => 'tracking_activity_line_9',
486 1730 => 'tracking_activity_line_10',
487 1731 => 'tracking_activity_line_11',
488 1732 => 'tracking_activity_line_12',
489 1733 => 'tracking_activity_line_13',
490 1734 => 'tracking_activity_line_14',
491 1735 => 'tracking_activity_line_15',
492 2254 => 'recipient_fax_number',
493 2382 => 'return_shipment_indicator',
494 3000 => 'cod_type_collection',
495 3001 => 'fedex_ground_purchase_order',
496 3002 => 'fedex_ground_invoice',
497 3003 => 'fedex_ground_customer_reference',
498 3008 => 'autopod_flag',
499 3009 => 'aod_flag',
500 3010 => 'oversize_flag',
501 3011 => 'other_oversize_flag',
502 3018 => 'nonstandard_container_flag',
503 3019 => 'fedex_signature_home_delivery_flag',
504 3020 => 'fedex_home_delivery_type',
505 3023 => 'fedex_home_delivery_date',
506 3024 => 'fedex_home_delivery_phone_number',
507 3025 => 'carrier_code',
508 3028 => 'ground_account_number',
509 3035 => 'ship_alert_fax_number',
510 3045 => 'cod_return_reference_indicator',
511 3046 => 'additional_handling_detected',
512 3053 => 'multiweight_net_charge',
513 3090 => 'last_ground_dropoff',
514 3091 => 'last_ground_dropoff_sat',
515 3092 => 'ground_service_flag',
516 3124 => 'oversize_classification',
517 4003 => 'subscriber_contact_name',
518 4004 => 'subscriber_password_reminder',
519 4007 => 'subscriber_company_name',
520 4008 => 'subscriber_address_line_1',
521 4009 => 'subscriber_address_line_2',
522 4011 => 'subscriber_city_name',
523 4012 => 'subscriber_state_code',
524 4013 => 'subscriber_postal_code',
525 4014 => 'subscriber_country_code',
526 4015 => 'subscriber_phone_number',
527 4017 => 'subscriber_pager_number',
528 4018 => 'subscriber_email_address',
529 4021 => 'subscription_service_name',
530 4022 => 'subscriber_fax_number'
531 };
532 ## Better to reverse this hash when sending data to FedEx
533 1 our $FE_SE;
534 1 ▶while (my ($tag, $name) = each %$FE_RE) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$Business::FedEx::Constants::FE_RE) 435 1 436
535 435 ▶ if (exists $FE_SE->{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Business::FedEx::Constants::FE_SE->{$name}) 0 435 435
536 0 die "Duplicate value `$name' in %FE_RE";
537 }
538 435 $FE_SE->{$name} = $tag;
539 }
540  
541 # For each of my hash refs set up a hash which allows only those keys.
542 #
543 # XXX also automatically lower-case the keys
544  
545 1 ▶for my $name (map { /^%(FE_\w+)/ ? $1 : () } @EXPORT) {
Branch: 1 branch
BranchTrueFalseTotal
/^%(FE_\w+)/ ? : 5 7 12
546 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
547 5 my $r = ${ $name };
548 5 tie %$name, 'Tie::StrictHash', %$r;
549 }
550  
551 0 ▶sub _split_tag {
Subroutine _split_tag: not called CC=5 SCAR=34.0
552 0 my ($tag) = @_;
553 0 ▶ my ($base, $mult) = ($tag =~ /^(.*?)(-[1-9]\d*)?\z/)
Branch: 1 branch
BranchTrueFalseTotal
() = $tag =~ /^(.*?)(-[1-9]\d*)?\z/ or croak("Invalid field tag or name `${tag}'") 0 0 0
554 or croak "Invalid field tag or name `$tag'";
555 0 ▶ $mult = '' if !defined $mult;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mult 0 0 0
556 #print "[$base] [$mult]";
557  
558 my $num = ($base =~ /^\d+\z/)
559 ? $base
560 0 ▶ : $FE_SE{lc $base};
Branch: 1 branch
BranchTrueFalseTotal
$base =~ /^\d+\z/ ? : 0 0 0
561 0 my $name = $FE_RE{$num};
562 0 ▶ defined $name
Branch: 1 branch
BranchTrueFalseTotal
defined $name or croak("Invalid FE_RE `${num}'") 0 0 0
563 or croak "Invalid FE_RE `$num'";
564 0 return $num, $name, $mult;
565 }
566  
567 0 ▶sub field_name_to_tag {
Subroutine field_name_to_tag: not called CC=2 SCAR=17.9
Pod documented
568 0 ▶ @_ == 1 or croak "need 1 arg, got ", 0+@_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("need 1 arg, got ", 0 + @_) 0 0 0
569 0 my ($in) = @_;
570  
571 0 my ($num, $name, $mult) = _split_tag $in;
572 0 return "$num$mult";
573 }
574  
575 0 ▶sub field_tag_to_name {
Subroutine field_tag_to_name: not called CC=2 SCAR=17.9
Pod documented
576 0 ▶ @_ == 1 or croak "need 1 arg, got ", 0+@_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("need 1 arg, got ", 0 + @_) 0 0 0
577 0 my ($in) = @_;
578  
579 0 my ($num, $name, $mult) = _split_tag $in;
580 0 return "$name$mult";
581 }
582  
583 0 ▶sub uti_by_tt_carrier {
Subroutine uti_by_tt_carrier: not called CC=4 SCAR=30.0
Pod documented
584 0 ▶ @_ == 2 or croak "need 2 args, got ", 0+@_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("need 2 args, got ", 0 + @_) 0 0 0
585 0 my ($tt, $carrier) = @_;
586  
587 return $FE_UTI_BY_TT{$tt}{$carrier}
588 0 ▶ || $FE_UTI_BY_TT{$tt}{''}
Condition0%0/5
$Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{$carrier} || $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{''} || croak("UTI for transaction [$tt] carrier [$carrier] unknown")
l!l
00
$Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{$carrier} or $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{""}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{$carrier} || $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{''} || croak("UTI for transaction [$tt] carrier [$carrier] unknown")
$Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{$carrier} $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{""}
Truth table0%0/3
A or B
A= $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{$carrier}B= $Business::FedEx::Constants::FE_UTI_BY_TT{$tt}{""}
ABresult
1X1
011
000
589 || croak "UTI for transaction [$tt] carrier [$carrier] unknown";
590 }
591  
592 1 1;
593 __END__
« DirectConnect.pm ↑ Summary