+ my @name_aliases;
+ use Unicode::UCD;
+ if (ord('A') != 65
+ || pack( "C*", split /\./, Unicode::UCD::UnicodeVersion()) ge v6.1.0)
+ {
+ open my $fh, "<", "../../lib/unicore/NameAliases.txt"
+ or die "Can't open ../../lib/unicore/NameAliases.txt: $!";
+ @name_aliases = <$fh>
+ }
+ else {
+
+ # If this Unicode version doesn't have the full .txt file, or are on
+ # an EBCDIC platform where they need to be translated, get the data
+ # from prop_invmap() (which should do the translation) and convert it
+ # to the file's format
+ use Unicode::UCD 'prop_invmap';
+ my ($invlist_ref, $invmap_ref, undef, $default)
+ = prop_invmap('Name_Alias');
+ for my $i (0 .. @$invlist_ref - 1) {
+
+ # Convert the aliases for code points that have just one alias to
+ # single element arrays for uniform handling below.
+ if (! ref $invmap_ref->[$i]) {
+
+ # But we test only the real aliases, not the ones which are
+ # just really placeholders.
+ next if $invmap_ref->[$i] eq $default;
+
+ $invmap_ref->[$i] = [ $invmap_ref->[$i] ];
+ }
+
+
+ # Change each alias for the code point to the form that the file
+ # has
+ foreach my $j ($invlist_ref->[$i] .. $invlist_ref->[$i+1] - 1) {
+ foreach my $value (@{$invmap_ref->[$i]}) {
+ $value =~ s/: /;/;
+ push @name_aliases, sprintf("%04X;%s\n", $j, $value);
+ }
+ }
+ }
+ }
+
+ for (@name_aliases) {