Subject: | Broken in Perl v5.21+ |
Date: | Mon, 30 Jun 2014 21:44:25 -0600 |
To: | bug-Devel-hdb [...] rt.cpan.org |
From: | Karl Williamson <public [...] khwilliamson.com> |
Perl v5.21 has changed the behavior of regular expression patterns.
This distribution has one that, as a result, no longer works. It is in
the test file 07-stack.t:
like($frame_filename, qr(\(eval \d+\)[$escaped_filename:\d+]),
"Filename stack frame $i");
The problem is that the pattern's delimiters are (), and there are also
occurrences of () within the pattern, escaped by preceding them by
backslashes. Until v5.21, those backslashes were effectively ignored,
so the interior () were read as a grouping to enable one to extract $1
from the match, if desired. Until 5.18, this ignoring the backslashes
was done silently. In 5.18 and 5.20, deprecation messages are raised to
warn you that this behavior is about to change in 5.21+. Going forward
the backslashes are not ignored, but are used to make the interior ()
match as literal left- and right- parentheses.
I would have submitted a patch, but I don't know what was intended here.
It's very unlikely that this pattern matches what was intended. It
looks like the match is supposed to include the filename followed by a
colon followed by some digits. However, since this is all enclosed in
square brackets, what is actually matched by this portion of the pattern
is a single character. It could be a colon, or a 'd' or a + or any of
the characters in the filename. But it is just a single character, and
not the whole filename. This doesn't look right. So I am leaving it to
you to fix it to your specifications. You can add the statement
use re qw(Debug COMPILE);
just before the regex (or any regex) to see what it actually compiles into.
Karl Williamson