Original computing articles by a systems administrator

Track UPS Packages with Perl – WebService::UPS

The Module:
I have made a Perl object oriented module for tracking UPS shipments. To use this module you will need to get a developer key for the UPS online tools here. This module makes a XML request to the online tools, and then parses the response using XML::Simple. The module has methods to get specific information such as recent activity. You can read the full module documentation as well as download the module at CPAN’s site here.


    my $Package = WebService::UPS::TrackRequest->new;
    print $Package->Username();
    my $trackedPackage = $Package->requestTrack();
    print $trackedPackage->getActivityList();

You can install this module with cpan. In Linux the command is ‘cpan -i WebService::UPS::TrackRequest’ . The required prerequisite modules are: Mouse, LWP::UserAgent , HTTP::Request::Common , XML::Simple , and Data::Dumper .

3 Responses to Track UPS Packages with Perl – WebService::UPS

  1. JDrago says:


    I’m happy to see new developments in the Perl->UPS area. Do you have any plans to add shipping rate requests as in http://search.cpan.org/perldoc?Business::Shipping::UPS_XML

    That module hasn’t been updated since 2004 and really could use a replacement.

  2. Kyle says:

    I wasn’t planning on it, but after the module has been out for a little bit I can look into it. There is actually is pretty extensive documentation (that was updated about a month ago) on the XML schema for the tracking information ( although I forget exactly where I found it) . I am pretty new to Perl, so feel free to offer any advice on how I can make the test suite more robust! I just wanted to get the module out there. Thanks for taking a look.

  3. Joshua Radke says:


    These Modules were fantastic (and easy!) for developing a simple application against UPS’s web service. I had a need to use a different ‘Option’ in TrackRequest, and modified (slightly) the module. The Content_Type modification was referred to in the UPS manual, I believe. I’d like to submit the changes back, but am uncertain who gets them. Here is a diff: (Feel free to contact me for the modified .pm)

    diff TrackRequest.pm TrackRequest.pm.orig
    ( is => ‘rw’,

    < ${\$self->Option}

    > activity
    request(POST $self->URL, Content_Type => ‘application/x-www-form-urlencoded’,

    > my $response = $userAgent->request(POST $self->URL, Content_Type => ‘text/xml’,

Leave a Reply