From 82aef7a207f7cccf21026a766968515e53fc1a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 22 Jun 2017 13:45:29 +0200 Subject: [PATCH] Fix importing from Encode::Encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ported to 2.90: commit 208d094b8cf82da488495400ea9a518841fd007a Author: Dan Kogai Date: Thu Jun 22 17:05:01 2017 +0900 Addressed: https://rt.cpan.org/Ticket/Display.html?id=122167 commit a2f702b28b5d93a96b83aff283575b5b155b50ac Author: Dan Kogai Date: Thu Jun 22 18:13:47 2017 +0900 Stop directory tweaking $Encode::Encoding{utf8} CPAN RT#122167 Signed-off-by: Petr Písař --- Encode.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Encode.pm b/Encode.pm index b0e9092..8813715 100644 --- a/Encode.pm +++ b/Encode.pm @@ -343,9 +343,14 @@ if ($ON_EBCDIC) { { package Encode::utf8; use parent 'Encode::Encoding'; - __PACKAGE__->Define('utf8'); - my $strict_obj = bless { Name => "utf-8-strict", strict_utf8 => 1 } => "Encode::utf8"; - Encode::define_encoding($strict_obj, 'utf-8-strict'); + my %obj = ( + 'utf8' => { Name => 'utf8' }, + 'utf-8-strict' => { Name => 'utf-8-strict', strict_utf8 => 1 } + ); + for ( keys %obj ) { + bless $obj{$_} => __PACKAGE__; + Encode::define_encoding( $obj{$_} => $_ ); + } sub cat_decode { # ($obj, $dst, $src, $pos, $trm, $chk) # currently ignores $chk -- 2.9.4