Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data::Dumper was erroneously stringifying qr'$foo' as qr/$foo/
qr// vs qr'' only affects whether variable interpolation happens in the parser. The compiled regex doesn't record which quote style it used. It turns out that $ always interpolates, unless it is at the end of the string or followed by ) or |. Otherwise, except in qr'', dollar-anything will interpolate that punctuation or regular variable. (Possibly violating strict) Meaning that if we see an unescaped $ that isn't at the end of the string, isn't followed by ) and isn't followed by |, then either the regular expression was written as qr'', *or* there was variable interpolation where the interpolated value was that literal dollar sign. We can exploit variable interpolation to generate a regex in qr// form equivalent to one written without interpolation in qr'' form, which is very useful as the XS code needs to use \x{} style escapes for non-ASCII literals in the regex. This approach suggested by Eirik Berg Hanssen. Bug reported as CPAN #84569
- Loading branch information
Showing
3 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters