Skip Menu |

This queue is for tickets about the Geo-StreetAddress-US CPAN distribution.

Report information
The Basics
Id: 17445
Status: resolved
Priority: 0/
Queue: Geo-StreetAddress-US

People
Owner: Nobody in particular
Requestors: mark.j.pickett [...] xo.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.99
Fixed in: (no value)



Subject: Support ZIP+4 without hyphen
Sometimes I have to deal with addresses with a ZIP+4 that doesn't have a hyphen. For instance, 606066306 instead of 60606-6306. Here's a patch that makes the hyphen optional. Thanks for a great module, Mark Pickett
Subject: US.pm.patch
--- US.pm Tue May 17 09:12:46 2005 +++ US.pm.new Thu Feb 2 11:24:11 2006 @@ -695,7 +695,7 @@ sort { length $b <=> length $a } values %Directional), dircode => join("|", keys %Direction_Code), - zip => qr/\d{5}(?:-\d{4})?/, + zip => qr/\d{5}(?:-?\d{4})?/, corner => qr/(?:\band\b|\bat\b|&|\@)/i, unit => qr/(?:(?:su?i?te|p\W*[om]\W*b(?:ox)?|dept|apt|ro*m|fl|apt|unit|box)\W+|#\W*)[\w-]+/i, );
From: mark.j.pickett [...] xo.com
Here is an updated patch that fixes a problem in normalize_address that the previous patch would have introduced. Thanks, Mark Pickett
--- US.pm Tue May 17 09:12:46 2005 +++ US.pm.new Thu Feb 2 15:05:43 2006 @@ -695,7 +695,7 @@ sort { length $b <=> length $a } values %Directional), dircode => join("|", keys %Direction_Code), - zip => qr/\d{5}(?:-\d{4})?/, + zip => qr/\d{5}(?:-?\d{4})?/, corner => qr/(?:\band\b|\bat\b|&|\@)/i, unit => qr/(?:(?:su?i?te|p\W*[om]\W*b(?:ox)?|dept|apt|ro*m|fl|apt|unit|box)\W+|#\W*)[\w-]+/i, ); @@ -876,7 +876,10 @@ if $part->{city}; # strip ZIP+4 - $part->{zip} =~ s/-.*$//os if $part->{zip}; + if ( $part->{zip} and $part->{zip} =~ /\d{5}-?\d{4}/ ) { + my $temp_zip = $part->{zip}; + $part->{zip} = substr($temp_zip,0,5); + } return $part; }
Fixed for next release. Thanks!