develooper Front page | perl.perl5.porters | Postings from March 2008

Re: There's something wrong with open.pm and Encode

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
March 12, 2008 01:51
Subject:
Re: There's something wrong with open.pm and Encode
Message ID:
b77c1dce0803120151o4166c3a0gfcfd14681ab7e10d@mail.gmail.com
On 12/03/2008, Rafael Garcia-Suarez <rgarciasuarez@gmail.com> wrote:
> Bingo!! this patch makes your one liner compile.
>  Of course, it's horribly awful.

Better patch committed now, see below. Dan, can you integrate the
change to Encode::Alias below into your copy of Encode ?

Change 33486 by rgs@scipion on 2008/03/12 08:50:11

	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.

Affected files ...

... //depot/perl/ext/Encode/lib/Encode/Alias.pm#41 edit
... //depot/perl/lib/open.t#28 edit

Differences ...

==== //depot/perl/ext/Encode/lib/Encode/Alias.pm#41 (text) ====

@@ -2,8 +2,7 @@
 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;    # cached known aliases

 sub find_alias {
+    require Encode;
     my $class = shift;
     my $find  = shift;
     unless ( exists $Alias{$find} ) {
@@ -128,6 +128,7 @@
 }

 sub init_aliases {
+    require Encode;
     undef_aliases();

     # Try all-lower-case version should all else fails

==== //depot/perl/lib/open.t#28 (text) ====

@@ -7,7 +7,7 @@
 	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 @@
     }
 }

+{
+    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';

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About