Business-UPS
view release on metacpan or search on metacpan
availability. GH #10
- Fix uninitialized value warning in UPStrack() when the API returns a
weight hash without a unitOfMeasurement field. PR #26
- Fix MANIFEST.SKIP regex issues: remove cpanfile exclusion conflict,
anchor patterns properly, add exclusions for generated files. PR #26
- Fix duplicate 'provides' key in META_MERGE that caused the second
entry to silently overwrite the first. PR #28
Improvements:
- Deprecate getUPS() with a warnings::warnif('deprecated', ...) message.
The UPS rate quoting endpoint (qcostcgi.cgi) has been retired. GH #7,
PR #8
- Replace custom Error() subroutine with Carp::croak for proper
caller-side error reporting with file/line context. PR #23
- Set a 30-second timeout and Business-UPS/$VERSION user-agent string on
all LWP::UserAgent requests to prevent indefinite hangs. PR #30
- Update examples/test.pl to demonstrate UPStrack() instead of the
non-functional getUPS(). PR #9
- Add author tests (AUTHOR_TESTING) for POD validity and POD
coverage. PR #24
- Add edge case tests for UPStrack: weight without unit, empty address,
lib/Business/UPS.pm view on Meta::CPAN
# Copyright 2003 Justin Wheeler <upsmodule@datademons.com>
# Copyright 1998 Mark Solomon <msolomon@seva.net> (See GNU GPL)
# Started 01/07/1998 Mark Solomon
our $VERSION = '2.04';
sub getUPS {
warnings::warnif( 'deprecated',
'getUPS() is deprecated: the UPS rate quoting endpoint (qcostcgi.cgi) '
. 'has been retired by UPS. This function will be removed in a future '
. 'release. See Business::UPS documentation for alternatives.' );
my (
$product, $origin, $dest, $weight, $country, $rate_chart, $length,
$width, $height, $oversized, $cod
) = @_;
$country ||= 'US';
lib/Business/UPS.pm view on Meta::CPAN
# 'Delivered' or 'In Transit'
print "This package is $track{'Current Status'}\n";
=head1 DESCRIPTION
A way of sending four arguments to a module to get shipping charges
that can be used in, say, a CGI.
B<NOTE:> The C<getUPS()> function is B<deprecated>. The UPS rate quoting
endpoint (C<qcostcgi.cgi>) it relied on has been permanently retired by UPS.
Calls to C<getUPS()> will emit a deprecation warning and will always fail
with an HTTP error. This function will be removed in a future release.
For rate quoting, consider using L<Business::Shipping> or the
L<UPS Rating API|https://developer.ups.com/api/reference?loc=en_US#tag/Rating_other>
directly.
=head1 REQUIREMENTS
I've tried to keep this package to a minimum, so you'll need:
lib/Business/UPS.pm view on Meta::CPAN
=item *
JSON::PP (core since Perl 5.14)
=back
=head1 ARGUMENTS for getUPS() (DEPRECATED)
B<This function is deprecated.> The UPS endpoint it uses no longer exists.
See L</DESCRIPTION> for alternatives.
Call the subroutine with the following values:
1. Product code (see product-codes.txt)
2. Origin Zip Code
3. Destination Zip Code
4. Weight of Package
and optionally:
subtest 'getUPS emits deprecation warning' => sub {
@warnings = ();
@mock_responses = (
MockResponse->new( success => 1, content => $success_response ),
);
getUPS(qw/GNDCOM 23606 23607 50/);
is( scalar @warnings, 1, 'exactly one warning emitted' );
like( $warnings[0], qr/deprecated/i, 'warning mentions deprecation' );
like( $warnings[0], qr/qcostcgi/, 'warning mentions retired endpoint' );
};
subtest 'getUPS returns shipping cost and zone on success' => sub {
@warnings = ();
@mock_responses = (
MockResponse->new( success => 1, content => $success_response ),
);
my ( $shipping, $zone, $error ) = getUPS(qw/GNDCOM 23606 23607 50/);
( run in 0.564 second using v1.01-cache-2.11-cpan-9581c071862 )