This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix perl #7305: UnicodeCD::compexcl is weird
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 24 Nov 2002 22:35:23 +0000 (22:35 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 24 Nov 2002 22:35:23 +0000 (22:35 +0000)
p4raw-id: //depot/maint-5.8/perl@18174

lib/Unicode/UCD.pm
lib/Unicode/UCD.t

index 96dee9a..b28c6f7 100644 (file)
@@ -295,6 +295,7 @@ my %BLOCKS;
 sub _charblocks {
     unless (@BLOCKS) {
        if (openunicode(\$BLOCKSFH, "Blocks.txt")) {
+           local $_;
            while (<$BLOCKSFH>) {
                if (/^([0-9A-F]+)\.\.([0-9A-F]+);\s+(.+)/) {
                    my ($lo, $hi) = (hex($1), hex($2));
@@ -356,6 +357,7 @@ my %SCRIPTS;
 sub _charscripts {
     unless (@SCRIPTS) {
        if (openunicode(\$SCRIPTSFH, "Scripts.txt")) {
+           local $_;
            while (<$SCRIPTSFH>) {
                if (/^([0-9A-F]+)(?:\.\.([0-9A-F]+))?\s+;\s+(\w+)/) {
                    my ($lo, $hi) = (hex($1), $2 ? hex($2) : hex($1));
@@ -493,6 +495,7 @@ my %COMPEXCL;
 sub _compexcl {
     unless (%COMPEXCL) {
        if (openunicode(\$COMPEXCLFH, "CompositionExclusions.txt")) {
+           local $_;
            while (<$COMPEXCLFH>) {
                if (/^([0-9A-F]+)\s+\#\s+/) {
                    my $code = hex($1);
@@ -563,6 +566,7 @@ my %CASEFOLD;
 sub _casefold {
     unless (%CASEFOLD) {
        if (openunicode(\$CASEFOLDFH, "CaseFolding.txt")) {
+           local $_;
            while (<$CASEFOLDFH>) {
                if (/^([0-9A-F]+); ([CFSI]); ([0-9A-F]+(?: [0-9A-F]+)*);/) {
                    my $code = hex($1);
@@ -643,6 +647,7 @@ my %CASESPEC;
 sub _casespec {
     unless (%CASESPEC) {
        if (openunicode(\$CASESPECFH, "SpecialCasing.txt")) {
+           local $_;
            while (<$CASESPECFH>) {
                if (/^([0-9A-F]+); ([0-9A-F]+(?: [0-9A-F]+)*)?; ([0-9A-F]+(?: [0-9A-F]+)*)?; ([0-9A-F]+(?: [0-9A-F]+)*)?; (\w+(?: \w+)*)?/) {
                    my ($hexcode, $lower, $title, $upper, $condition) =
index de791e2..07d8a89 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 use Unicode::UCD;
 use Test::More;
 
-BEGIN { plan tests => 162 };
+BEGIN { plan tests => 164 };
 
 use Unicode::UCD 'charinfo';
 
@@ -279,3 +279,13 @@ ok($casespec->{az}->{code} eq '0307' &&
    $casespec->{az}->{upper} eq '0307' &&
    $casespec->{az}->{condition} eq 'az After_I',
    'casespec 0x307');
+
+# perl #7305 UnicodeCD::compexcl is weird
+
+for (1) {$a=compexcl $_}
+ok(1, 'compexcl read-only $_: perl #7305');
+grep {compexcl $_} %{{1=>2}};
+ok(1, 'compexcl read-only hash: perl #7305');
+
+