]> Sergey Matveev's repositories - public-inbox.git/commit
eml: reduce RE captures and possible side effects
authorEric Wong <e@yhbt.net>
Sat, 9 May 2020 08:27:36 +0000 (08:27 +0000)
committerEric Wong <e@yhbt.net>
Sat, 9 May 2020 20:27:34 +0000 (20:27 +0000)
commit1e64f2f0450477ffbb95b887511bdeec28e30ab0
tree8cb5d39ab93f1cf6e8c45b7ecda791c0f3d7eaf9
parentc8e8c8107913df9c67c5eeee86d20f633d11a6d4
eml: reduce RE captures and possible side effects

Since Perl 5.6, the `@-' (aka @LAST_MATCH_START) and `@+' (aka
@LAST_MATCH_END) arrays provides integer offsets for every match
as documented in perlvar(1), regardless of regexp modifiers.

We can avoid relying on $1 in the epilogue scan, entirely.

So use these instead of relying on m//g and pos(), since the `g'
modifier can be affected by m//g matches performed in other
places.

Unrelated, but while we're in the area: remove some unnecessary
use of (?:...), too.
lib/PublicInbox/Eml.pm