Back in November 2014 there was a thread:
  "sa-update lint fail on __PDS_FROM_2_EMAILS"

which resulted in the introduction of a can(perl_min_version_...) directive: [Bug 7107] RFE: if() preprocessor directive should support a test for perl version

I don't mind having the possibility to test for a perl version,
so I'm fine with that.



Admittedly a possessive quantifier (+) is a very nice perl feature
and it would be very useful to get free hands in using it more widely in
rules, eliminating some clutter and hardening backtracking in some rules.

But looking at four rules in 72_active.cf that require a possessive quantifier
and need to be protected by if can(), and two additional meta rules that
require protection because they depend on the first three rules,
one may wonder if it is worth it. As the possessive quantifier is
just a shorthand for the independent subexpression (?>pattern), which
was introduced with 5.8, wouldn't it be just easier to rewrite these
few rules and avoid the possessive quantifier, along with all their
conditionals.

For example the:

  if can(Mail::SpamAssassin::Conf::perl_min_version_5010000)
header __PDS_FROM_2_EMAILS From =~ /^\W+([\w+.-]+\@[\w.-]+\.\w\w++)(?:[^\n\w<]{0,80})?<(?!\1)[^\n\s]*\@/i
  endif

would become:

header __PDS_FROM_2_EMAILS From =~ /^\W+([\w+.-]+\@[\w.-]+\.\w(?>\w+))(?:[^\n\w<]{0,80})?<(?!\1)[^\n\s]*\@/i

and the [^\n\w<]++ in __PDS_TO_EQ_FROM_NAME_1 would become (?>[^\n\w<]+)


  Mark

Reply via email to