Subject: | Fix warnings with perl 5.32 |
Quoting from <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=974143>
# perl -we 'use Encode::Arabic'
Useless use of /d modifier in transliteration operator at (eval 5) line 6.
Useless use of /d modifier in transliteration operator at (eval 7) line 6.
Useless use of /d modifier in transliteration operator at (eval 9) line 6.
Running with 'perl -d' shows these come from
Useless use of /d modifier in transliteration operator at (eval 10)[/usr/share/perl5/Encode/Arabic/Habash.pm:163] line 6.
Useless use of /d modifier in transliteration operator at (eval 8)[/usr/share/perl5/Encode/Arabic/Parkinson.pm:157] line 6.
Useless use of /d modifier in transliteration operator at (eval 6)[/usr/share/perl5/Encode/Arabic/Buckwalter.pm:161] line 6.
Quoting https://perldoc.perl.org/perldiag#Useless-use-of-/d-modifier-in-transliteration-operator
(W misc) You have used the /d modifier where the searchlist has the same length as the replacelist.
The difference between Perl versions seems to be that 5.32 has become
smarter about non-ASCII character ranges, as seen with
# perl -we '$0 =~ tr/\x{0626}-\x{0628}/abc/d'
which warns with 5.32 but not with 5.30.
I'm guessing this changed somewhere around
https://github.com/Perl/perl5/commits/f34acfecc286f2eff2450db713da005d888a7317
and it looks to me like this is not a regression in Perl and
Encode::Arabic needs to adapt.
Given the transliteration lists are built dynamically in the code, maybe
the thing to do is just to insert some "no warnings 'misc'" declarations
to suppress the warnings.
See attached patch which we are applying in Debian.
Subject: | no-warnings.diff |
Description: Avoid 'Useless use of /d modifier' warnings
Bug: https://rt.cpan.org/Ticket/Display.html?id=116572
Author: gregor herrmann <gregoa@debian.org>
--- a/lib/Encode/Arabic/Buckwalter.pm
+++ b/lib/Encode/Arabic/Buckwalter.pm
@@ -158,6 +158,9 @@
undef &encoder;
+ # https://bugs.debian.org/974143
+ no warnings 'misc';
+
eval q /
sub encoder ($) {
--- a/lib/Encode/Arabic/Habash.pm
+++ b/lib/Encode/Arabic/Habash.pm
@@ -160,6 +160,9 @@
undef &encoder;
+ # https://bugs.debian.org/974143
+ no warnings 'misc';
+
eval q /
sub encoder ($) {
--- a/lib/Encode/Arabic/Parkinson.pm
+++ b/lib/Encode/Arabic/Parkinson.pm
@@ -154,6 +154,9 @@
undef &encoder;
+ # https://bugs.debian.org/974143
+ no warnings 'misc';
+
eval q /
sub encoder ($) {