Permalink
Browse files

Fixed space in state name thanks to Nate Blaylock. RT#30109

  • Loading branch information...
1 parent 6094b28 commit 51c3cb8eab0810f90335cc73c3891f76c4bbb33c @timbunce committed May 1, 2011
Showing with 17 additions and 2 deletions.
  1. +1 −0 Changes
  2. +4 −1 US.pm
  3. +12 −1 t/01_parser.t
View
@@ -3,6 +3,7 @@ Revision history for Perl extension Geo::StreetAddress::US.
1.00 TBD
Fixed lower cased city direction thanks to Al Sary. RT#50476.
+ Fixed space in state name thanks to Nate Blaylock. RT#30109.
0.99 May 17 2005
View
5 US.pm
@@ -684,7 +684,10 @@ our %Addr_Match = (
type => join("|", keys %_Street_Type_List),
number => qr/\d+-?\d*/,
fraction => qr{\d+\/\d+},
- state => join("|", %State_Code),
+ state => join("|",
+ # escape spaces in state names (e.g., "new york" --> "new\\ york")
+ # so they still match in the x environment below
+ map { ( quotemeta $_) } keys %State_Code, values %State_Code),
direct => join("|",
# map direction names to direction codes
keys %Directional,
View
@@ -1,7 +1,8 @@
use blib;
-use Test::More tests => 39;
+use Test::More tests => 40;
use strict;
use warnings;
+use Data::Dumper;
use_ok( "Geo::StreetAddress::US" );
@@ -360,6 +361,16 @@ my %address = (
'type' => 'St',
'prefix' => undef
},
+ "123 Maple Rochester, New York" => { # space in state name
+ 'number' => '123',
+ 'street' => 'Maple',
+ 'state' => 'NY',
+ 'city' => 'Rochester',
+ 'zip' => undef,
+ 'suffix' => undef,
+ 'type' => '',
+ 'prefix' => undef
+ },
);
my @failures = (

0 comments on commit 51c3cb8

Please sign in to comment.