Warn about unknown scripts.
Dominic Dunlop [Mon, 9 Oct 2000 14:57:17 +0000 (16:57 +0200)]
Subject: Re: ideas? patches? [PATCH bleadperl]
Message-Id: <p04320400b6076a75b15f@[192.168.1.4]>

p4raw-id: //depot/perl@7178

lib/charnames.pm

index 7c2209b..0ec7ec2 100644 (file)
@@ -1,5 +1,6 @@
 package charnames;
 use bytes ();          # for $bytes::hint_bits
+use warnings();
 $charnames::hint_bits = 0x20000;
 
 my $txt;
@@ -51,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 /;
+       }
+  }
 }