The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

        Business::UPSShipping - A UPS Shipping Cost Module

SYNOPSIS

    use Business::UPSShipping;

    $ship = new Business::UPSShipping (qw/GNDCOM 23606 23607 50/);
    $ship->getUPSShipping || die "ERROR:\n" . $ship->error,"\n";

    print "Shipping is \$" . $ship->total_shipping . "\n";
    print "UPS Zone is \$" . $ship->ups_zone . "\n";

DESCRIPTION

        A way of sending four arguments to a module to get 
        shipping charges that can be used in, say, a CGI.

REQUIREMENTS

        I've tried to keep this package to a minimum, so you'll need:
  • Perl 5.003 or higher

  • LWP Module

  • Carp Module

ARGUMENTS

        Construct the shipping object
        Construct the UPSShipping object with the following values in order:
                1. Product code
                2. Origin Zip Code
                3. Destination Zip Code
                4. Weight of Package
  1.         Product Codes:
    
                      1DM           Next Day Air Early AM
                      1DML          Next Day Air Early AM Letter
                      1DA           Next Day Air
                      1DAL          Next Day Air Letter
                      1DP           Next Day Air Saver
                      1DPL          Next Day Air Saver Letter
                      2DM           2nd Day Air A.M.
                      2DA           2nd Day Air
                      2DML          2nd Day Air A.M. Letter
                      2DAL          2nd Day Air Letter
                      3DS           3 Day Select
                      GNDCOM        Ground Commercial
                      GNDRES        Ground Residential
    
            In an HTML "option" input it might look like this:
    
                      <OPTION VALUE="1DM">Next Day Air Early AM
                      <OPTION VALUE="1DML">Next Day Air Early AM Letter
                      <OPTION SELECTED VALUE="1DA">Next Day Air
                      <OPTION VALUE="1DAL">Next Day Air Letter
                      <OPTION VALUE="1DP">Next Day Air Saver
                      <OPTION VALUE="1DPL">Next Day Air Saver Letter
                      <OPTION VALUE="2DM">2nd Day Air A.M.
                      <OPTION VALUE="2DA">2nd Day Air
                      <OPTION VALUE="2DML">2nd Day Air A.M. Letter
                      <OPTION VALUE="2DAL">2nd Day Air Letter
                      <OPTION VALUE="3DS">3 Day Select
                      <OPTION VALUE="GNDCOM">Ground Commercial
                      <OPTION VALUE="GNDRES">Ground Residential
  2. 2. Origin Zip(tm) Code

                    Origin Zip Code as a number or string (NOT +4 Format)
  3. 3. Destination Zip(tm) Code

                    Destination Zip Code as a number or string (NOT +4 Format)
  4. 4. Weight

                    Weight of the package in pounds

RETURN VALUES

        The raw http get() returns a list with the following values:

          ##  Desc              Typical Value
          --  ---------------   -------------
          0.  Name of server:   UPSOnLine3
          1.  Product code:     GNDCOM
          2.  Orig Postal:      23606
          3.  Country:          US
          4.  Dest Postal:      23607
          5.  Country:          US
          6.  Shipping Zone:    002
          7.  Weight (lbs):     50
          8.  Sub-total Cost:   7.75
          9.  Addt'l Chrgs:     0.00
          10. Total Cost:       7.75
          11. ???:              -1

        If anyone wants these available for some reason, let me know.

EXAMPLES

        To retreive the shipping of a 'Ground Commercial' Package 
        weighing 25lbs. sent from 23001 to 24002 this package would 
        be called like this:

          #!/usr/local/bin/perl

          use Business::UPSShipping;

          my $ship = new Business::UPSShipping (qw/GNDCOM 23001 23002 25/);
          my $ship->getUPSShipping || die $ship->error;

          print "Shipping using Ground Commercial is \$" . $ship->total_shipping . "\n";  
          print "UPS Zone is " . $ship->ups_zone . "\n";  

        If you have to recompute the shipping later, simply redifine the
        changed value and get the new shipping. 
        The values to change are:
                product         ex.     $ship->product('GNDCOM');
                origin          ex.     $ship->origin('12345');
                dest            ex.     $ship->dest('12345');
                weight          ex.     $ship->weight('50');
        For example, since the above
        example figured for 'Ground Commercial' (GNDCOM) to refigure for
        '2nd Day Air' (2DA):

          $ship->product('2DA');
          my $ship->getUPSShipping || die $ship->error;

          print "Shipping using 2nd Day Air is \$" . $ship->total_shipping . "\n";  
          print "UPS Zone is " . $ship->ups_zone . "\n";  

AUTHOR

        Mark Solomon <msolomon@seva.net>
        mailto:msolomon@seva.net
        http://www.seva.net/~msolomon/

        NOTE: UPS is a registered trademark of United Parcel Service.

6 POD Errors

The following errors were encountered while parsing the POD:

Around line 137:

=back doesn't take any parameters, but you said =back 4

Around line 148:

'=item' outside of any '=over'

Around line 182:

Expected '=item 2'

Around line 187:

Expected '=item 3'

Around line 192:

Expected '=item 4'

Around line 197:

You forgot a '=back' before '=head1'