From: Nick Ing-Simmons Date: Thu, 3 May 2001 16:22:30 +0000 (+0000) Subject: Fix latin1 etc. alias code - (bit rot?) - the @latin2iso array now seems to need X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6d6a7c8da03005f2939b162fdb831faae6901085;p=p5sagit%2Fp5-mst-13.2.git Fix latin1 etc. alias code - (bit rot?) - the @latin2iso array now seems to need to be in scope (fair enough), and also a package variable (our) for eval to see it. p4raw-id: //depot/perlio@9975 --- diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 9bdc041..dda842d 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -42,6 +42,9 @@ use Carp; our %encoding; my @alias; # ordered matching list my %alias; # cached known aliases + # 0 1 2 3 4 5 6 7 8 9 10 +our @latin2iso_num = ( 0, 1, 2, 3, 4, 9, 10, 13, 14, 15, 16 ); + sub encodings { @@ -60,7 +63,6 @@ sub findAlias my $alias = $alias[$i]; my $val = $alias[$i+1]; my $new; - if (ref($alias) eq 'Regexp' && $_ =~ $alias) { $new = eval $val; @@ -101,8 +103,6 @@ sub define_alias define_alias( qr/^iso[-_]?(\d+)[-_](\d+)$/i => '"iso-$1-$2"' ); # Allow latin-1 style names as well - # 0 1 2 3 4 5 6 7 8 9 10 -my @latin2iso_num = ( 0, 1, 2, 3, 4, 9, 10, 13, 14, 15, 16 ); define_alias( qr/^latin[-_]?(\d+)$/i => '"iso-8859-$latin2iso_num[$1]"' ); # Common names for non-latin prefered MIME names