AnyEvent

 view release on metacpan or  search on metacpan

util/gen_uts46data  view on Meta::CPAN

#!/opt/bin/perl

# creates lib/AnyEvent/Util/uts46.pl - better do not run it!

use common::sense;
use utf8;
no warnings 'utf8';

binmode STDOUT, ":utf8";

open my $fh, "GET http://www.unicode.org/Public/idna/9.0.0/IdnaMappingTable.txt |"
   or die;

my $valid;
my $imap;   # index map \x00 char replacement

while (<$fh>) {
   next unless /^[0-9A-F]/;

util/gen_uts46data  view on Meta::CPAN

            for $r1 .. $r2 || $r1;
      }
      default {
         die "default: $R1,$R2,$type,$map;\n";
      }
   }
}

open my $fh, ">lib/AnyEvent/Util/uts46data.pl"
   or die;
binmode $fh, ":perlio";
print $fh "# autogenerated by util/gen_uts46data\n";

utf8::encode $imap;
0 > index $imap, "\x02" # it's not supposed to be anywhere in there
   or die "imap contains \\x02";
print $fh "\$uts46_imap = q\x02$imap\x00\x02;\n";

# try to find a valid quoting character - there usually are many legal combos
for (1..127) { # stay out of utf-8 range
   if (0 >= index $valid, chr) {



( run in 0.566 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )