Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dankogai committed Jun 22, 2017
1 parent 1d2c1a2 commit 208d094
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 10 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
#
# $Id: Changes,v 2.90 2017/06/10 17:23:50 dankogai Exp dankogai $
#
$Revision: 2.90 $ $Date: 2017/06/10 17:23:50 $
$Revision: 2.90 $ $Date: 2017/06/10 17:23:50$
! Encode.pm
Addressed: RT#122167: use parent q{Encode::Encoding}; fails:
Can't locate object
https://rt.cpan.org/Ticket/Display.html?id=122167
! Makefile.PL
Pulled: fix gcc warnings for older gcc < 4.0
https://github.com/dankogai/p5-encode/pull/114

2.90 2017/06/10 17:23:50
! Makefile.PL
Pulled: Include all contributors into META
https://github.com/dankogai/p5-encode/pull/111
Expand Down
7 changes: 5 additions & 2 deletions Encode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,12 @@ if ($ON_EBCDIC) {

{
package Encode::utf8;
BEGIN {
$Encode::Encoding{utf8} = bless { Name => 'utf8' } => __PACKAGE__;

This comment has been minimized.

Copy link
@pali

pali Jun 22, 2017

Contributor

Do not assign object directly to $Encode::Encoding{utf8}. Rather use Encode::define_encoding as below as that function is doing more (like define alias or set correctly CARP_NOT).

This comment has been minimized.

Copy link
@dankogai

dankogai Jun 22, 2017

Author Owner

That was my first attempt and it failed. I tried it again to show how specifically it failed and this time it worked. Hmm... What was I doing…

--- a/Encode.pm
+++ b/Encode.pm
@@ -342,10 +342,10 @@ if ($ON_EBCDIC) {
 
 {
     package Encode::utf8;
-    BEGIN {
-        $Encode::Encoding{utf8} = bless { Name => 'utf8' } => __PACKAGE__;
-    }
     use parent 'Encode::Encoding';
+    my $utf8_obj =
+        bless { Name => 'utf8'} => __PACKAGE__;
+    Encode::define_encoding($utf8_obj, 'utf8');
     my $strict_obj =
       bless { Name => 'utf-8-strict', strict_utf8 => 1 } => __PACKAGE__;
     Encode::define_encoding($strict_obj, 'utf-8-strict');
}
use parent 'Encode::Encoding';
__PACKAGE__->Define('utf8');
my $strict_obj = bless { Name => "utf-8-strict", strict_utf8 => 1 } => "Encode::utf8";
my $strict_obj =
bless { Name => 'utf-8-strict', strict_utf8 => 1 } => __PACKAGE__;
Encode::define_encoding($strict_obj, 'utf-8-strict');
sub cat_decode {
# ($obj, $dst, $src, $pos, $trm, $chk)
Expand Down

0 comments on commit 208d094

Please sign in to comment.