Memoize tests
[p5sagit/p5-mst-13.2.git] / lib / utf8_heavy.pl
index 3e145de..06b2266 100644 (file)
@@ -23,10 +23,12 @@ sub SWASHNEW {
 
        defined %utf8::In || do "unicore/In.pl";
 
-       $type =~ s/^In(?:[-_]|\s+)?//i;
+       $type =~ s/^In(?:[-_]|\s+)?(?!herited$)//i;
        $type =~ s/\s+$//;
 
-       my $inprefix = substr(lc($type), 0, 3);
+        $type = 'Lampersand' if $type =~ /^(?:Is)?L&$/;
+
+       my $inprefix = substr(lc($type), 0, 2);
        if (exists $utf8::InPat{$inprefix}) {
            my $In = $type;
            for my $k (keys %{$utf8::InPat{$inprefix}}) {
@@ -41,18 +43,19 @@ sub SWASHNEW {
            }
        }
 
-       # This is separate from 'To' in preparation of Is.pl (a la In.pl).
-       if ((not defined $file) && $type =~ /^Is([A-Z][A-Za-z]*)$/) {
-           $file = "unicore/Is/$1";
-       }
-
-       if ((not defined $file) && $type =~ /^To([A-Z][A-Za-z]*)$/) {
-           $file = "unicore/To/$1";
+       unless (defined $file) {
+           # This is separate from 'To' in preparation of Is.pl (a la In.pl).
+           if ($type =~ /^Is([A-Z][A-Za-z]*)$/) {
+               $file = "unicore/Is/$1";
+           } elsif ((not defined $file) && $type =~ /^To([A-Z][A-Za-z]*)$/) {
+               $file = "unicore/To/$1";
+           }
        }
     }
 
     {
         $list ||= do "$file.pl"
+             ||  do "unicore/Is/$type.pl"
              ||  croak("Can't find Unicode character property \"$type\"");
     }