You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2019/08/12 12:51:46 UTC
svn commit: r1864964 - /spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Author: hege
Date: Mon Aug 12 12:51:46 2019
New Revision: 1864964
URL: http://svn.apache.org/viewvc?rev=1864964&view=rev
Log:
Bug 6802 - use /aa in compile_regex with Perl 5.16+
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=1864964&r1=1864963&r2=1864964&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Mon Aug 12 12:51:46 2019
@@ -1949,6 +1949,14 @@ sub trap_sigalrm_fully {
###########################################################################
+# Bug 6802 helper function, use /aa for perl 5.16+
+my $qr_sa;
+if ($] >= 5.016) {
+ eval '$qr_sa = sub { return qr/$_[0]/aa; }';
+} else {
+ eval '$qr_sa = sub { return qr/$_[0]/; }';
+}
+
# returns ($compiled_re, $error)
# if any errors, $compiled_re = undef, $error has string
# args:
@@ -2046,7 +2054,7 @@ sub compile_regexp {
die "$_[0]\n";
}
};
- $compiled_re = qr/$re/;
+ $compiled_re = $qr_sa->($re);
1;
};
if ($ok && ref($compiled_re) eq 'Regexp') {