Jarkko Hietaniemi wrote:
> I think nobody has tried t/uni/class.t with -w for a while, there are
> quite a lot of warnings.

Here's a patch based on Sadahiro-san's suggestions:



--- t/uni/class.t.dist  2005-05-28 11:20:50.000000000 +0300
+++ t/uni/class.t       2005-05-28 11:41:19.000000000 +0300
@@ -57,14 +57,16 @@
 is(($str =~ /(\p{sc:InGreek}+)/)[0], "\x{038B}\x{038C}\x{038D}");
 is(($str =~ /(\p{sc=InGreek}+)/)[0], "\x{038B}\x{038C}\x{038D}");
 
-
 use File::Spec;
 my $updir = File::Spec->updir;
 
-
 # the %utf8::... hashes are already in existence
 # because utf8_pva.pl was run by utf8_heavy.pl
 
+*utf8::PropertyAlias = *utf8::PropertyAlias; # thwart a warning
+
+no warnings 'utf8'; # we do not want warnings about surrogates etc
+
 # non-General Category and non-Script
 while (my ($abbrev, $files) = each %utf8::PVA_abbr_map) {
   my $prop_name = $utf8::PropertyAlias{$abbrev};
@@ -77,7 +79,7 @@
     );
 
     next unless -e $filename;
-    my ($h1, $h2) = map hex, split /\t/, (do $filename);
+    my ($h1, $h2) = map hex, (split(/\t/, (do $filename), 3))[0,1];
     my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1);
 
     for my $p ($prop_name, $abbrev) {
@@ -97,7 +99,7 @@
     );
 
     next unless -e $filename;
-    my ($h1, $h2) = map hex, split /\t/, (do $filename);
+    my ($h1, $h2) = map hex, (split(/\t/, (do $filename), 3))[0,1];
     my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1);
 
     for my $x ($p, { gc => 'General Category', sc => 'Script' }->{$p}) {
@@ -127,7 +129,7 @@
 
   my $dirname = File::Spec->catdir($updir => lib => unicore => lib => gc_sc);
   opendir D, $dirname or die $!;
-  @files{readdir D} = ();
+  @files{readdir(D)} = ();
   closedir D;
 
   for (keys %utf8::PA_reverse) {
@@ -136,7 +138,7 @@
 
     my $filename = File::Spec->catfile($dirname, $leafname);
 
-    my ($h1, $h2) = map hex, split /\t/, (do $filename);
+    my ($h1, $h2) = map hex, (split(/\t/, (do $filename), 3))[0,1];
     my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1);
 
     for my $x ('gc', 'General Category') {
@@ -158,7 +160,7 @@
   );
 
   next unless -e $filename;
-  my ($h1, $h2) = map hex, split /\t/, (do $filename);
+  my ($h1, $h2) = map hex, (split(/\t/, (do $filename), 3))[0,1];
   my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1);
 
   my $blk = $_;

Reply via email to