]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 818621: Perl 5.16 complains with "Variable length lookbehind not implemented...
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 19 Dec 2012 22:52:54 +0000 (23:52 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 19 Dec 2012 22:52:54 +0000 (23:52 +0100)
r=dkl a=LpSolit

extensions/Example/Extension.pm

index 885a8e8ff779e45f236667d94a6cbef6d9ce96c9..c0b3c6210abd7ad91caf368d5e1ba8b7dc4fa711 100644 (file)
@@ -371,7 +371,13 @@ sub error_catch {
     my $new_error_msg = "Ah ah, you tried to access $page_id? Good try!";
     $new_error_msg = html_quote($new_error_msg);
     # There are better tools to parse an HTML page, but it's just an example.
-    $$page =~ s/(?<=<td id="error_msg" class="throw_error">).*(?=<\/td>)/$new_error_msg/si;
+    # Since Perl 5.16, we can no longer write "class" inside look-behind
+    # assertions, because "ss" is also seen as the german ß character, which
+    # makes Perl 5.16 complain. The right fix is to use the /aa modifier,
+    # but it's only understood since Perl 5.14. So the workaround is to write
+    # "clas[s]" instead of "class". Stupid and ugly hack, but it works with
+    # all Perl versions.
+    $$page =~ s/(?<=<td id="error_msg" clas[s]="throw_error">).*(?=<\/td>)/$new_error_msg/si;
 }
 
 sub flag_end_of_update {