Subject: | [PATCH] Synchronize encoding.pm with blead |
In bleadperl (5.25.3-to-be), the functionality of the ${^ENCODING} variable is no longer supported, so encoding.pm dies unless invoked with the Filter option.
The attached patch contains the changes made in blead.
Also, bleadperl currently uses 2.17_01 temporarily as the version. I did not include the version hunk in the patch, since no doubt you will use something else, like 2.18.
If you disagree with any of this, by all means, please speak up on p5p. Thank you.
Subject: | open_6jOV70zj.txt |
diff -rup Encode-2.84-dueVua/encoding.pm /Users/sprout/perl/perl.git-copy/cpan/Encode/encoding.pm
--- Encode-2.84-dueVua/encoding.pm 2016-04-11 00:17:04.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/encoding.pm 2016-07-14 18:13:21.000000000 -0700
@@ -114,10 +114,9 @@ sub import {
Carp::croak("encoding: pragma does not support EBCDIC platforms");
}
- if ($] >= 5.017) {
- warnings::warnif("deprecated",
- "Use of the encoding pragma is deprecated")
- }
+ my $deprecate =
+ $] >= 5.017 ? "Use of the encoding pragma is deprecated" : 0;
+
my $class = shift;
my $name = shift;
if (!$name){
@@ -142,6 +141,12 @@ sub import {
}
$name = $enc->name; # canonize
unless ( $arg{Filter} ) {
+ if ($] >= 5.025003) {
+ require Carp;
+ Carp::croak("The encoding pragma is no longer supported");
+ }
+ warnings::warnif("deprecated",$deprecate) if $deprecate;
+
DEBUG and warn "_exception($name) = ", _exception($name);
if (! _exception($name)) {
if (!PERL_5_21_7) {
@@ -158,6 +163,8 @@ sub import {
HAS_PERLIO or return 1;
}
else {
+ warnings::warnif("deprecate",$deprecate) if $deprecate;
+
defined( ${^ENCODING} ) and undef ${^ENCODING};
undef ${^E_NCODING} if PERL_5_21_7;
@@ -280,6 +287,10 @@ Old code should be converted to UTF-8, v
L</SYNOPSIS> (though this simple approach may require manual adjustments
afterwards).
+If UTF-8 is not an option, it is recommended that one use a simple source
+filter, such as that provided by L<Filter::Encoding> on CPAN or this
+pragma's own C<Filter> option (see below).
+
The only legitimate use of this pragma is almost certainly just one per file,
near the top, with file scope, as the file is likely going to only be written
in one encoding. Further restrictions apply in Perls before v5.22 (see
@@ -291,6 +302,9 @@ There are two basic modes of operation (
=item C<use encoding ['I<ENCNAME>'] ;>
+Please note: This mode of operation is no longer supported as of Perl
+v5.26.
+
This is the normal operation. It translates various literals encountered in
the Perl source file from the encoding I<ENCNAME> into UTF-8, and similarly
converts character code points. This is used when the script is a combination
Only in /Users/sprout/perl/perl.git-copy/cpan/Encode/: pm_to_blib
diff -rup Encode-2.84-dueVua/t/enc_data.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_data.t
--- Encode-2.84-dueVua/t/enc_data.t 2016-04-11 00:17:06.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_data.t 2016-07-13 01:12:58.000000000 -0700
@@ -14,6 +14,10 @@ BEGIN {
print "1..0 # encoding pragma does not support EBCDIC platforms\n";
exit(0);
}
+ if ("$]" >= 5.025) {
+ print "1..0 # encoding pragma not supported in Perl 5.26\n";
+ exit(0);
+ }
if ($] <= 5.008 and !$Config{perl_patchlevel}){
print "1..0 # Skip: Perl 5.8.1 or later required\n";
exit 0;
diff -rup Encode-2.84-dueVua/t/enc_eucjp.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_eucjp.t
--- Encode-2.84-dueVua/t/enc_eucjp.t 2016-04-11 00:17:06.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_eucjp.t 2016-07-13 01:12:58.000000000 -0700
@@ -19,6 +19,10 @@ BEGIN {
print "1..0 # Skip: Perl 5.8.1 or later required\n";
exit 0;
}
+ if ($] >= 5.025003){
+ print "1..0 # Skip: Perl 5.25.2 or lower required\n";
+ exit 0;
+ }
}
no warnings "deprecated";
diff -rup Encode-2.84-dueVua/t/enc_module.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_module.t
--- Encode-2.84-dueVua/t/enc_module.t 2016-04-11 00:17:06.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_module.t 2016-07-13 01:12:58.000000000 -0700
@@ -18,6 +18,10 @@ BEGIN {
print "1..0 # encoding pragma does not support EBCDIC platforms\n";
exit(0);
}
+ if ("$]" >= 5.025) {
+ print "1..0 # encoding pragma not supported in Perl 5.26\n";
+ exit(0);
+ }
}
use lib qw(t ext/Encode/t ../ext/Encode/t); # latter 2 for perl core
use Mod_EUCJP;
diff -rup Encode-2.84-dueVua/t/enc_utf8.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_utf8.t
--- Encode-2.84-dueVua/t/enc_utf8.t 2016-04-11 00:17:06.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/enc_utf8.t 2016-07-13 01:12:58.000000000 -0700
@@ -15,6 +15,10 @@ BEGIN {
print "1..0 # encoding pragma does not support EBCDIC platforms\n";
exit(0);
}
+ if ($] >= 5.025003){
+ print "1..0 # Skip: Perl 5.25.2 or lower required\n";
+ exit 0;
+ }
}
no warnings "deprecated";
diff -rup Encode-2.84-dueVua/t/encoding.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/encoding.t
--- Encode-2.84-dueVua/t/encoding.t 2015-09-13 19:27:20.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/encoding.t 2016-07-13 01:12:58.000000000 -0700
@@ -12,6 +12,10 @@ BEGIN {
print "1..0 # encoding pragma does not support EBCDIC platforms\n";
exit(0);
}
+ if ("$]" >= 5.025) {
+ print "1..0 # encoding pragma not supported in Perl 5.26\n";
+ exit(0);
+ }
}
print "1..33\n";
diff -rup Encode-2.84-dueVua/t/jperl.t /Users/sprout/perl/perl.git-copy/cpan/Encode/t/jperl.t
--- Encode-2.84-dueVua/t/jperl.t 2016-04-11 00:17:06.000000000 -0700
+++ /Users/sprout/perl/perl.git-copy/cpan/Encode/t/jperl.t 2016-07-13 01:12:58.000000000 -0700
@@ -17,6 +17,10 @@ BEGIN {
print "1..0 # Skip: EBCDIC\n";
exit 0;
}
+ if ("$]" >= 5.025) {
+ print "1..0 # encoding pragma not supported in Perl 5.26\n";
+ exit(0);
+ }
$| = 1;
}