From: Rafael Garcia-Suarez Date: Wed, 12 Mar 2008 08:50:11 +0000 (+0000) Subject: An unfortunate side-effect of Encode and Encode::Alias use'ing each X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0abe5aa023c241a7c62916f78986356631f76c7;p=p5sagit%2Fp5-mst-13.2.git An unfortunate side-effect of Encode and Encode::Alias use'ing each other, and Encode::Alias exporting functions into Encode for it to use as methods, broke the loading of the find_alias() Encode method in some cases since 5.10. Breaking the recursive inheritance fixes it. p4raw-id: //depot/perl@33486 --- diff --git a/ext/Encode/lib/Encode/Alias.pm b/ext/Encode/lib/Encode/Alias.pm index b865f0d..24e7d82 100644 --- a/ext/Encode/lib/Encode/Alias.pm +++ b/ext/Encode/lib/Encode/Alias.pm @@ -2,8 +2,7 @@ package Encode::Alias; use strict; use warnings; no warnings 'redefine'; -use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.7 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = '2.07_01'; #do { my @r = ( q$Revision: 2.7 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; sub DEBUG () { 0 } use base qw(Exporter); @@ -20,6 +19,7 @@ our @Alias; # ordered matching list our %Alias; # cached known aliases sub find_alias { + require Encode; my $class = shift; my $find = shift; unless ( exists $Alias{$find} ) { @@ -128,6 +128,7 @@ sub undef_aliases { } sub init_aliases { + require Encode; undef_aliases(); # Try all-lower-case version should all else fails diff --git a/lib/open.t b/lib/open.t index 9c36e1a..1c4a99e 100644 --- a/lib/open.t +++ b/lib/open.t @@ -7,7 +7,7 @@ BEGIN { require Config; import Config; } -use Test::More tests => 22; +use Test::More tests => 23; # open::import expects 'open' as its first argument, but it clashes with open() sub import { @@ -181,6 +181,11 @@ EOE } } +{ + eval q[use Encode::Alias;use open ":std", ":locale"]; + is($@, '', 'can use :std and :locale'); +} + SKIP: { skip("no perlio", 1) unless (find PerlIO::Layer 'perlio'); use open IN => ':non-existent';