Subject: | Fix for change at USPS website - broken DPB, county, route, check digit |
An update to the USPS website has changed the method they used for
displaying the delivery point code, county, route number and check
digit. Now it's reported via a javascript function. I've updated the
module to pull the data straight from the javascript call.
Address, city, state and zip are still working in the updated version,
only the additional information was changed.
Subject: | ZipLookup.pm.diff |
--- ZipLookup.pm.old 2006-03-26 22:35:17.000000000 -0500
+++ ZipLookup.pm 2006-05-28 12:32:03.000000000 -0400
@@ -21,7 +21,7 @@
use strict;
use warnings;
-our $VERSION = '2.4';
+our $VERSION = '2.5';
use WWW::Mechanize; # To communicate with USPS and get HTML
@@ -200,7 +200,7 @@
my @matches;
$content =~ s/(\cI|\cJ|\cM)//g;
- my @raw_matches = map { trim($_) } $content =~ m{<td headers="full" height="34" valign="top" class="main" style="background:url\(images/table_gray\.gif\); padding:5px 10px;">(.*?)<br \/><\/td> }gsi;
+ my @raw_matches = map { trim($_) } $content =~ m{<td headers="full" height="34" valign="top" class="main" style="background:url\(images/table_gray\.gif\); padding:5px 10px;">(.*?)>Mailing Industry Information</a>}gsi;
foreach my $raw_match (@raw_matches) {
my $carrier_route = undef;
@@ -210,13 +210,14 @@
# if ($cell =~ m/mail_info_pop2.jsp\?carrier=(\w*)&county=(\w*)&dpoint=(\w*)&cdigit=(\w*)&lac=&elot=0176&elotind=A&rectype=S&pmbdes=&pmbnum=&dflag=&ews="
- if ($raw_match =~ m/mail_info_pop2.jsp\?carrier=(\w*)&county=(\w*)&dpoint=(\w*)&cdigit=(\w*)/i) {
+ if ($raw_match =~ m/mailingIndustryPopup2\(\'(\w*)\',\s*\'(\w*)\',\s*\'(\w*)\',\s*\'(\w*)\'/im) {
$carrier_route = $1;
$county = $2;
$delivery_point = $3;
$check_digit = $4;
}
+ $raw_match =~ s{</td>.*}{}g;
$raw_match =~ s{</?font.*?>}{}g;
$raw_match =~ s{</?span.*?>}{}g;
$raw_match =~ s{</?a.*?>}{}g;