Scrape::USPS::ZipLookup Perl Module 2.4 review

Download
by rbytes.net on

The United States Postal Service (USPS) has on its web site an HTML form at http://www.usps.com/zip4/ for standardizing an address

License: Artistic License
File size: 10K
Developer: Gregor N. Purdy
0 stars award from rbytes.net

The United States Postal Service (USPS) has on its web site an HTML form at http://www.usps.com/zip4/ for standardizing an address. Given a firm, urbanization, street address, city, state, and zip, it will put the address into standard form (provided the address is in their database) and display a page with the resulting address.

Scrape::USPS::ZipLookup Perl Module provides a programmatic interface to this service, so you can write a program to process your entire personal address book without having to manually type them all in to the form.

Because the USPS could change or remove this functionality at any time, be prepared for the possibility that this code may fail to function. In fact, as of this version, there is no error checking in place, so if they do change things, this code will most likely fail in a noisy way. If you discover that the service has changed, please email the author your findings.

If an error occurs in trying to standardize the address, then no array will be returned. Otherwise, a four-element array will be returned.
To see debugging output, call $zlu->verbose(1).

SYNOPSIS

#!/usr/bin/perl

use Scrape::USPS::ZipLookup::Address;
use Scrape::USPS::ZipLookup;

my $addr = Scrape::USPS::ZipLookup::Address->new(
'Focus Research, Inc.', # Firm
'', # Urbanization
'8080 Beckett Center Drive Suite 203', # Delivery Address
'West Chester', # City
'OH', # State
'45069-5001' # ZIP Code
);

my $zlu = Scrape::USPS::ZipLookup->new();

my @matches = $zlu->std_addr($addr);

if (@matches) {
printf "n%d matches:n", scalar(@matches);
foreach my $match (@matches) {
print "-" x 39, "n";
print $match->to_string;
print "n";
}
print "-" x 39, "n";
}
else {
print "No matches!n";
}

exit 0;

What's New in This Release:
Adapt to yet another round of changes to the USPS Zip Lookup web site, courtesy of Eric Parker.
Copyright date updates.

Scrape::USPS::ZipLookup Perl Module 2.4 search tags