Business::DPD::Label - one DPD label
use Business::DPD::Label; my $label = Business::DPD::Label->new( $dpd, { zip => '12555', country => 'DE', depot => '1090', serial => '50123456%0878', service_code => '101', weight => '6 kg', }); $label->calc_fields; say $label->tracking_number; say $label->d_sort; use Business::DPD::Label; my $label2 = Business::DPD::Label->new( $dpd, { address => Business::DPD::Address->new($dpd, { name1 => 'Hans Mustermann GmbH', street => 'Musterstr. 12a', postal => '63741', city => 'Aschaffenburg', country => 'DE', phone => '06021/112', }), serial => '9700001010', service_code => '101', shipment_count_this => 1, shipment_count_total => 2, reference_number => [ 'Testpaket2' ], weight_g => 6000, });
Calculate the data that's needed for a valid addresse label.
my $label = Business::DPD::Label->new( $dpd, { zip => '12555', country => 'DE', depot => '1090', serial => '5012345678', service_code => '101', });
TODO?: take a Business::DPD::Address as an agrument (instead of zip & country)
$label->calc_fields;
Calculate all caluclatable fields from the provided data using the DPD database from $schema:
$schema
target_country
$label->calc_tracking_number;
Calulates the tracking number and stores it in tracking_number. tracking_number consists of
tracking_number
DDDDXXLLLLLLLLP | | | | | | | +-> iso7064_mod37_36_checksum L | | +----> serial 12345678 | +----------> first two positions of serial 50 +------------> depot 1090
We additionally store the checksum in checksum_tracking_number and the tracking_number_without_checksum
checksum_tracking_number
tracking_number_without_checksum
$label->calc_routing; $label->o_sort
Calculates the following fields:
o_sort d_sort d_depot barcode_id
$label->calc_target_country_code;
Store the numeric country code from the alpha2 target country (i.e.: 'DE' -> 276) into target_country_code
target_country_code
$label->service_text
Returns the service text for the given service code
$label->calc_barcode;
Generate the various parts of the barcode, which are:
code
PPPPPPPTTTTTTTTTTTTTTSSSCCC
code_human
PPPPPPPTTTTTTTTTTTTTTSSSCCCP
code_barcode
IPPPPPPPTTTTTTTTTTTTTTSSSCCC
And here's the explanation of those strange letter:
IPPPPPPPTTTTTTTTTTTTTTSSSCCCP | | | | | | | | | | | +-> iso7064_mod37_36_checksum Z | | | | +---> target_country_code 276 | | | +------> service_code 101 | | +--------------> tracking_number_without_checksum 01905002345615 | +-------------------------> zip (zero padded) 0012555 +-----------------------------> barcode_id %
* weiters:
kennzeichnung (kleingewicht, Express) Servicetext Servicecode
* one object for one address * required fields ** target country ** target zipcode ** laufende nummer ** depot number ** service code * semi-required ** address data * optional ** referenznummer ** auftragsnummer ** gewicht ** n of m ** template
RevDev <we {at} revdev.at>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Business::DPD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::DPD
CPAN shell
perl -MCPAN -e shell install Business::DPD
For more information on module installation, please visit the detailed CPAN module installation guide.