NAME

Business::Shipping - Cost estimation and tracking for UPS and USPS

SYNOPSIS

Rate request example

use Business::Shipping;

my $rate_request = Business::Shipping->rate_request(
    shipper   => 'Offline::UPS',
    service   => 'GNDRES',
    from_zip  => '98682',
    to_zip    => '98270',
    weight    =>  5.00,
);    

$rate_request->submit() or logdie $rate_request->user_error();

print $rate_request->total_charges();

Shipping tasks implemented at this time

  • UPS shipment cost calculation using UPS Online WebTools.

  • UPS shipment cost calculation using offline tables.

  • USPS shipment cost calculation using USPS Online WebTools.

  • UPS shipment tracking.

  • USPS shipment tracking.

Shipping tasks planned for future addition

  • USPS zip code lookup

  • USPS address verification

  • USPS shipment cost estimation via offline tables

  • FedEX shipment cost estimation

REQUIRED MODULES

Bundle::DBD::CSV (any)
Cache::FileCache (any)
Class::MethodMaker::Engine (any)
Clone (any)
Config::IniFiles (any)
Crypt::SSLeay (any)
Getopt::Mixed (any)
Log::Log4perl (any)
LWP::UserAgent (any)
Math::BaseCnv (any)
Scalar::Util (1.10)
XML::DOM (any)
XML::Simple (2.05)

INSTALLATION

perl -MCPAN -e 'install Bundle::Business::Shipping'

See the INSTALL file for more information.

ERROR/DEBUG HANDLING

Log4perl is used for logging error, debug, etc. messages. See config/log4perl.conf. For simple manipulation of the current log level, use the Business::Shipping->log_level( $log_level ) class method (below).

METHODS

$self->init( %args )

Generic attribute setter.

$self->user_error( "Error message" )

Log and store errors that should be visibile to the user.

$self->validate()

Confirms that the object is valid. Checks that required attributes are set.

rate_request()

This method is used to request shipping rate information from online providers or offline tables. A hash is accepted as input with the following key values:

  • shipper

    The name of the shipper to use. Must correspond to a module by the name of: Business::Shipping::SHIPPER. For example, UPS_Online.

  • user_id

    A user_id, if required by the provider. Online::USPS and Online::UPS require this, while Offline::UPS does not.

  • password

    A password, if required by the provider. Online::USPS and Online::UPS require this, while Offline::UPS does not.

  • service

    A valid service name for the provider. See the corresponding module documentation for a list of services compatible with the shipper.

  • from_zip

    The origin zipcode.

  • from_state

    The origin state in two-letter code format or full-name format. Required for Offline::UPS.

  • to_zip

    The destination zipcode.

  • to_country

    The destination country. Required for international shipments only.

  • weight

    Weight of the shipment, in pounds, as a decimal number.

Business::Shipping->new_subclass( "Subclass::Name", %opt )

Generates a subclass, such as a Shipment object.

Business::Shipping->log_level( $log_level )

Sets the log level for all Business::Shipping objects.

$log_level can be 'debug', 'info', 'warn', 'error', or 'fatal'.

AUTHOR

Dan Browning <db@kavod.com>, Kavod Technologies, http://www.kavod.com.

COPYRIGHT AND LICENCE

Copyright (c) 2003-2004 Kavod Technologies, Dan Browning. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See LICENSE for more info.