Thomas Klausner > Business-DPD > Business::DPD

Download:
Business-DPD-0.22.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.22   Source  

NAME ^

Business::DPD - handle DPD label generation

SYNOPSIS ^

    use Business::DPD;
    my $dpd = Business::DPD->new();
    $dpd->connect_schema;
    my $label = $dpd->generate_label({
        zip             => '12555',
        country         => 'DE',
        depot           => '1090',
        serial          => '5012345678',
        service_code    => '101',    
    });
    say $label->tracking_number;
    say $label->d_sort;

    use Business::DPD;
    my $dpd = Business::DPD->new();
    $dpd->connect_schema;
    $dpd->set_originator_address({
        name1   => 'DELICom DPD GmbH',
        street  => 'Wailandtstrasse 1',
        postal  => '63741',
        city    => 'Aschaffenburg',
        country => 'DE',
        phone   => '06021/ 0815',
        fax     => '06021/ 0816',
        email   => 'test.dpd@dpd.com',
        depot   => '0176',
    }));
    my $label = $dpd->generate_label({
        address         => Business::DPD::Address->new($dpd,{ ... });
        serial          => '5012345678',
        service_code    => '101',
    });
    say $label->tracking_number;
    say $label->d_sort;

DESCRIPTION ^

Calculate routing information for parcel sending via DPD (http://dpd.com)

Generate labels for parcels (including barcode)

METHODS ^

Public Methods

new

    my $dpd = Business::DPD->new();

Perl default, Business::DPD will use the included SQLite DB and Business::DPD::DBIC::Schema. If you want to use another DB or another schema-class, you can define them via the options schema_class and dbi_connect.

    my $dpd = Business::DPD->new({
        schema_class => 'Your::Schema::DPD',
        dbi_connect  => ['dbi:Pg:dbname=yourdb','dbuser','dbpasswd', { } ],
    });

connect_schema

    $dpd->connect_schema;

Connect to the Schema/DB specified in new.

Stores the DBIx::Class Schema in $dpd->schema.

generate_label

    my $label = $dpd->generate_label({
        zip             => '12555',
        country         => 'DE',
        depot           => '1090',
        serial          => '5012345678',
        service_code    => '101',    
    });

country_code

    my $country_num = $dpd->country_code('DE');

country_alpha2

    my $country = $dpd->country_alpha2(276);

routing_meta

    my $routing_version = $dpd->routing_meta->version;

Returns Business::DPD::DBIC::Schema::DpdMeta object.

TO GENERATE DPD ROUTE DATABASE ^

    cd Business-DPD
    mkdir route-db
    cd route-db
    wget https://www.dpdportal.sk/download/routing_tables/rlatest_rev_dpdshipper_legacy.zip
    unzip rlatest_rev_dpdshipper_legacy.zip
    cd ..
    rm -f lib/Business/DPD/dpd.sqlite
    perl -Ilib helper/generate_sqlite_db.pl
    perl -Ilib helper/import_dpd_data.pl route-db/
    perl Build.PL
    perl Build test
    sudo perl Build install

AUTHOR ^

Thomas Klausner domm AT cpan.org

Jozef Kutej jozef@kutej.net

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: