This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Preserve explicit 'm' when deparsing m?PATTERN?
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Thu, 2 Jan 2014 13:18:18 +0000 (14:18 +0100)
committerMatthew Horsfall (alh) <wolfsage@gmail.com>
Tue, 17 Jun 2014 12:07:22 +0000 (08:07 -0400)
Bare ?PATTERN? is no longer allowed

lib/B/Deparse.pm
lib/B/Deparse.t

index e7eb8cf..43a7c35 100644 (file)
@@ -4789,7 +4789,7 @@ sub matchop {
     $flags = $matchwords{$flags} if $matchwords{$flags};
     if ($pmflags & PMf_ONCE) { # only one kind of delimiter works here
        $re =~ s/\?/\\?/g;
-       $re = "?$re?";
+       $re = "m?$re?";        # explicit 'm' is required
     } elsif ($quote) {
        $re = single_delim($name, $delim, $re);
     }
index 811f960..c804b70 100644 (file)
@@ -1447,3 +1447,6 @@ $x = $a[1] + $a[126] + $a[127] + $a[128] + $a[255] + $a[256];
 my @b;
 $x = $b[-256] + $b[-255] + $b[-129] + $b[-128] + $b[-127] + $b[-1] + $b[0];
 $x = $b[1] + $b[126] + $b[127] + $b[128] + $b[255] + $b[256];
+####
+# 'm' must be preserved in m??
+m??;