Subject: | [PATCH] regex warning at PostalAddress.pm line 238 |
Date: | Wed, 11 May 2016 09:45:52 -0700 |
To: | bug-Geo-PostalAddress [...] rt.cpan.org |
From: | Jim Avera <jim.avera [...] gmail.com> |
Hello,
perl 5.22 emits the following warning when using Geo::PostalAddress :
Unescaped left brace in regex is deprecated, passed through in
regex; marked by <-- HERE in m/\${ <-- HERE ([^{}]+)}/ at
/home/jima/perl5/lib/perl5/Geo/PostalAddress.pm line 238.
I think this is because the { could be confused with a {min,max} regex
quantifier in
$line =~ s/\${([^{}]+)}/$display->{$1}/eg;
Here is a patch which I think fixes the problem. I have not run your
regression tests, though!
Thanks,
-Jim Avera
--- Geo/PostalAddress.pm.OLD 2016-05-11 16:39:34.043883952 +0000
+++ Geo/PostalAddress.pm 2016-05-11 16:39:55.771855476 +0000
@@ -235,7 +235,7 @@
my $line = $segment->{StoredTemplate};
my $rownum = $segment->{StoredRownum};
- $line =~ s/\${([^{}]+)}/$display->{$1}/eg;
+ $line =~ s/\$\{([^{}]+)\}/$display->{$1}/eg;
if ($rownum < 0) {
$storage_bottom[1 - $rownum] = $line;