On Sun Nov 18 02:19:32 2012, SPROUT wrote:
Show quoted text> We would like to deprecate and remove the perl core support for
> encoding.pm, for several reasons:
>
> • The implementation is quite pervasive, making it harder to fix bugs
> in perl without breaking encoding.pm.
> • The implementation is already full of bugs, and nobody is fixing them.
> • Any time someone brings it up on p5p, the general consensus is that
> one should avoid using encoding.pm.
> • Even if we could fix the bugs, it still breaks Perl’s string model.
> "\x{ff}\x{100}" does not give me characters 255 and 256. In fact,
> there is no way for me to get Unicode character 255 under latin 2.
>
> Please consider the attached patch.
Here is a better patch that suppressing the warnings in the test suite.
diff -rup Encode-2.47-oaTvCA/encoding.pm Encode-2.47-0dOOqx/encoding.pm
--- Encode-2.47-oaTvCA/encoding.pm 2012-11-17 23:16:46.000000000 -0800
+++ Encode-2.47-0dOOqx/encoding.pm 2012-11-17 23:16:44.000000000 -0800
@@ -102,6 +102,10 @@ sub _get_locale_encoding {
}
sub import {
+ if ($] >= 5.017) {
+ warnings::warnif("deprecated",
+ "Use of the encoding pragma is deprecated")
+ }
my $class = shift;
my $name = shift;
if (!$name){
@@ -203,6 +207,12 @@ __END__
encoding - allows you to write your script in non-ascii or non-utf8
+=head1 WARNING
+
+This module is deprecated under perl 5.18. It uses a mechanism provided by
+perl that is deprecated under 5.18 and higher, and may be removed in a
+future version.
+
=head1 SYNOPSIS
use encoding "greek"; # Perl like Greek to you?
diff -rup Encode-2.47-oaTvCA/t/Mod_EUCJP.pm Encode-2.47-0dOOqx/t/Mod_EUCJP.pm
--- Encode-2.47-oaTvCA/t/Mod_EUCJP.pm 2012-08-14 22:36:25.000000000 -0700
+++ Encode-2.47-0dOOqx/t/Mod_EUCJP.pm 2012-11-17 23:31:42.000000000 -0800
@@ -1,6 +1,7 @@
# $Id: Mod_EUCJP.pm,v 2.0 2004/05/16 20:55:17 dankogai Exp $
# This file is in euc-jp
package Mod_EUCJP;
+no warnings "deprecated";
use encoding "euc-jp";
sub new {
my $class = shift;
diff -rup Encode-2.47-oaTvCA/t/enc_data.t Encode-2.47-0dOOqx/t/enc_data.t
--- Encode-2.47-oaTvCA/t/enc_data.t 2012-08-14 22:36:17.000000000 -0700
+++ Encode-2.47-0dOOqx/t/enc_data.t 2012-11-17 23:27:38.000000000 -0800
@@ -22,6 +22,7 @@ BEGIN {
use strict;
+no warnings "deprecated";
use encoding 'euc-jp';
use Test::More tests => 4;
diff -rup Encode-2.47-oaTvCA/t/enc_eucjp.t Encode-2.47-0dOOqx/t/enc_eucjp.t
--- Encode-2.47-oaTvCA/t/enc_eucjp.t 2012-08-14 22:36:17.000000000 -0700
+++ Encode-2.47-0dOOqx/t/enc_eucjp.t 2012-11-17 23:28:33.000000000 -0800
@@ -21,6 +21,7 @@ BEGIN {
}
}
+no warnings "deprecated";
use encoding 'euc-jp';
my @c = (127, 128, 255, 256);
diff -rup Encode-2.47-oaTvCA/t/enc_module.t Encode-2.47-0dOOqx/t/enc_module.t
--- Encode-2.47-oaTvCA/t/enc_module.t 2012-08-14 22:36:23.000000000 -0700
+++ Encode-2.47-0dOOqx/t/enc_module.t 2012-11-17 23:29:01.000000000 -0800
@@ -21,6 +21,7 @@ BEGIN {
}
use lib qw(t ext/Encode/t ../ext/Encode/t); # latter 2 for perl core
use Mod_EUCJP;
+no warnings "deprecated";
use encoding "euc-jp";
use Test::More tests => 3;
use File::Basename;
diff -rup Encode-2.47-oaTvCA/t/enc_utf8.t Encode-2.47-0dOOqx/t/enc_utf8.t
--- Encode-2.47-oaTvCA/t/enc_utf8.t 2012-08-14 22:36:17.000000000 -0700
+++ Encode-2.47-0dOOqx/t/enc_utf8.t 2012-11-17 23:29:16.000000000 -0800
@@ -17,6 +17,7 @@ BEGIN {
}
}
+no warnings "deprecated";
use encoding 'utf8';
my @c = (127, 128, 255, 256);
diff -rup Encode-2.47-oaTvCA/t/encoding.t Encode-2.47-0dOOqx/t/encoding.t
--- Encode-2.47-oaTvCA/t/encoding.t 2009-09-07 07:57:26.000000000 -0700
+++ Encode-2.47-0dOOqx/t/encoding.t 2012-11-17 23:29:37.000000000 -0800
@@ -16,6 +16,7 @@ BEGIN {
print "1..31\n";
+no warnings "deprecated";
use encoding "latin1"; # ignored (overwritten by the next line)
use encoding "greek"; # iso 8859-7 (no "latin" alias, surprise...)
diff -rup Encode-2.47-oaTvCA/t/jperl.t Encode-2.47-0dOOqx/t/jperl.t
--- Encode-2.47-oaTvCA/t/jperl.t 2012-08-14 22:36:23.000000000 -0700
+++ Encode-2.47-0dOOqx/t/jperl.t 2012-11-17 23:29:59.000000000 -0800
@@ -27,6 +27,7 @@ use strict;
use Test::More tests => 15; # black magic tests commented out
my $Debug = shift;
+no warnings "deprecated";
no encoding; # ensure
my $Enamae = "\xbe\xae\xbb\xf4\x20\xc3\xc6"; # euc-jp, with \x escapes
use encoding "euc-jp";