diff options
author | Karl Williamson <khw@cpan.org> | 2021-08-21 09:44:37 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-08-31 22:16:38 -0600 |
commit | 3c2792cafcd25f84f84483ee9e35a73261bfa543 (patch) | |
tree | 615e01dc94d2831c4fa0e2345e4326bceb5cb979 /lib/Unicode | |
parent | e3d65f9f899d4ea3445f8813e16ddef935cb3d06 (diff) | |
download | perl-3c2792cafcd25f84f84483ee9e35a73261bfa543.tar.gz |
Unicode::UCD: Don't depend on a file current syntax
This generated file will be changed in a future commit. This shouldn't
have been relying on its syntax anyway, but the value it returns.
Diffstat (limited to 'lib/Unicode')
-rw-r--r-- | lib/Unicode/UCD.pm | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/Unicode/UCD.pm b/lib/Unicode/UCD.pm index b33f64039d..6f4c4b2502 100644 --- a/lib/Unicode/UCD.pm +++ b/lib/Unicode/UCD.pm @@ -2346,25 +2346,23 @@ my %NAMEDSEQ; sub _namedseq { unless (%NAMEDSEQ) { - my $namedseqfh = openunicode("Name.pl"); - local $_; - local $/ = "\n"; - while (<$namedseqfh>) { - next if m/ ^ \s* \# /x; - - # Each entry is currently two lines. The first contains the code + my @list = split "\n", do "unicore/Name.pl"; + for (my $i = 0; $i < @list; $i += 3) { + # Each entry is currently three lines. The first contains the code # points in the sequence separated by spaces. If this entry # doesn't have spaces, it isn't a named sequence. - if (/^ [0-9A-F]{4,5} (?: \ [0-9A-F]{4,5} )+ $ /x) { - my $sequence = $_; - chomp $sequence; - - # And the second is the name - my $name = <$namedseqfh>; - chomp $name; - my @s = map { chr(hex($_)) } split(' ', $sequence); - $NAMEDSEQ{$name} = join("", @s); - } + next unless $list[$i] =~ /^ [0-9A-F]{4,5} (?: \ [0-9A-F]{4,5} )+ $ /x; + + my $sequence = $list[$i]; + chomp $sequence; + + # And the second is the name + my $name = $list[$i+1]; + chomp $name; + my @s = map { chr(hex($_)) } split(' ', $sequence); + $NAMEDSEQ{$name} = join("", @s); + + # And the third is empty } } } |