root/Net-IDN-Nameprep/trunk/lib/Net/IDN/Nameprep/Prohibited.pm

Revision 319 (checked in by miyagawa, 19 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package Net::IDN::Nameprep::Prohibited;
2
3 use strict;
4 require v5.6.0;
5 our $VERSION = '0.01';
6
7 my $table = <<'EOF';
8 0000-002C
9 002E-002F
10 003A-0040
11 005B-0060
12 007B-007F
13 0080-009F
14 00A0
15 1680
16 2000
17 2001
18 2002
19 2003
20 2004
21 2005
22 2006
23 2007
24 2008
25 2009
26 200A
27 200B
28 200E
29 200F
30 2028
31 2029
32 202A
33 202B
34 202C
35 202D
36 202E
37 202F
38 206A
39 206B
40 206C
41 206D
42 206E
43 206F
44 2FF0-2FFF
45 3000
46 3002
47 D800-DFFF
48 E000-F8FF
49 FFF9
50 FFFA
51 FFFB
52 FFFC
53 FFFD
54 FFFE-FFFF
55 1FFFE-1FFFF
56 2FFFE-2FFFF
57 3FFFE-3FFFF
58 4FFFE-4FFFF
59 5FFFE-5FFFF
60 6FFFE-6FFFF
61 7FFFE-7FFFF
62 8FFFE-8FFFF
63 9FFFE-9FFFF
64 AFFFE-AFFFF
65 BFFFE-BFFFF
66 CFFFE-CFFFF
67 DFFFE-DFFFF
68 EFFFE-EFFFF
69 F0000-FFFFD
70 FFFFE-FFFFF
71 100000-10FFFD
72 10FFFE-10FFFF
73 EOF
74     ;
75
76 my @prohibited;
77 while ($table =~ m/^(.*)$/gm) {
78     # XXX inefficient
79     my($from, $to) = split /-/, $1;
80     if (defined $to) {
81         $prohibited[$_] = 1 for hex($from) .. hex($to);
82     } else {
83         $prohibited[hex $from] = 1;
84     }
85 }
86
87 sub prohibited {
88     my($class, $code) = @_;
89     return exists $prohibited[$code];
90 }
91
92 1;
93
94 __END__
95
96 =head1 NAME
97
98 Net::IDN::Nameprep::Prohibited - Nameprep prohibited table
99
100 =head1 AUTHOR
101
102 Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
103
104 This library is free software; you can redistribute it and/or modify
105 it under the same terms as Perl itself.
106
107 =head1 SEE ALSO
108
109 L<Net::IDN::Mapping>
110
111 =cut
Note: See TracBrowser for help on using the browser.