Integrate perlio:
[p5sagit/p5-mst-13.2.git] / lib / charnames.pm
index 21b4dd6..0ec7ec2 100644 (file)
@@ -1,8 +1,8 @@
 package charnames;
 use bytes ();          # for $bytes::hint_bits
+use warnings();
 $charnames::hint_bits = 0x20000;
 
-my $fname = 'unicode/UnicodeData-Latest.txt';
 my $txt;
 
 # This is not optimized in any way yet
@@ -52,6 +52,13 @@ sub import {
   $^H{charnames_full} = delete $h{':full'};
   $^H{charnames_short} = delete $h{':short'};
   $^H{charnames_scripts} = [map uc, keys %h];
+  if (warnings::enabled('utf8') && @{$^H{charnames_scripts}}) {
+       $txt = do "unicode/Name.pl" unless $txt;
+    for (@{$^H{charnames_scripts}}) {
+        warnings::warn('utf8',  "No such script: '$_'") unless
+           $txt =~ m/\t\t$_ (?:CAPITAL |SMALL )?LETTER /;
+       }
+  }
 }