Fix variable scoping

master
David Wilkins 2014-07-02 11:28:55 +08:00
parent ad93b9ad90
commit 1d65006411
1 changed files with 8 additions and 10 deletions

View File

@ -26,33 +26,33 @@ triggers any => "convert", "dms", "decimal", "latitude", "longitude", "minutes",
# overview of the most common representations of latitude/longitude # overview of the most common representations of latitude/longitude
#Potential Unicode and other representations of "degrees" #Potential Unicode and other representations of "degrees"
state $degQR = qr/ my $degQR = qr/
[º°]| [º°]|
((arc[-]?)?deg(ree)?s?) ((arc[-]?)?deg(ree)?s?)
/ix; /ix;
#Potential Unicode and other representations of "minutes" #Potential Unicode and other representations of "minutes"
state $minQR = qr/ my $minQR = qr/
['`ʹ]| ['`ʹ]|
((arc[-]?)?min(ute)?s?) ((arc[-]?)?min(ute)?s?)
/ix; /ix;
#Potential Unicode and other representations of "seconds" #Potential Unicode and other representations of "seconds"
state $secQR = qr/ my $secQR = qr/
["]| ["]|
$minQR{2}| $minQR{2}|
(arc[-]?)?sec(ond)?s? (arc[-]?)?sec(ond)?s?
/ix; /ix;
#Match a decimal or integer number #Match a decimal or integer number
state $numQR = qr/[\d\.]+/; my $numQR = qr/[\d\.]+/;
#Match a minus sign or attempt at minus sign or word processor #Match a minus sign or attempt at minus sign or word processor
# interpretation of minus sign # interpretation of minus sign
state $minusQR = qr/[-−﹣-‒–—‐]/; my $minusQR = qr/[-−﹣-‒–—‐]/;
#Match a latitude/longitude representation #Match a latitude/longitude representation
state $latLonQR = qr/ my $latLonQR = qr/
(?<minus>$minusQR)? (?<minus>$minusQR)?
(?<degrees>$numQR)$degQR (?<degrees>$numQR)$degQR
((?<minutes>$numQR)$minQR ((?<minutes>$numQR)$minQR
@ -60,15 +60,14 @@ state $latLonQR = qr/
(?<cardinal>[NSEW]|(north)|(south)|(east)|(west))? (?<cardinal>[NSEW]|(north)|(south)|(east)|(west))?
/ix; /ix;
our %cardinalSign = ( my %cardinalSign = (
N => 1, N => 1,
S => -1, S => -1,
E => 1, E => 1,
W => -1, W => -1,
); );
our %cardinalName = ( my %cardinalName = (
n => 'N', n => 'N',
north => 'N', north => 'N',
s => 'S', s => 'S',
@ -77,7 +76,6 @@ our %cardinalName = (
east => 'E', east => 'E',
w => 'W', w => 'W',
west => 'W' west => 'W'
); );
handle query_nowhitespace => sub { handle query_nowhitespace => sub {