| 1 | package Unicode::Security; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Unicode::Security::Confusables; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Unicode::Normalize qw(NFD); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use Unicode::UCD qw(charinfo charscript); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our $VERSION = '0.06'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | skeleton confusable soss restriction_level mixed_script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | mixed_number mixed_num | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | whole_script_confusable mixed_script_confusable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ws_confusable ms_confusable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | our (%MA, %WS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | UNRESTRICTED => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ASCII_ONLY => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | SINGLE_SCRIPT => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | HIGHLY_RESTRICTIVE => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | MODERATELY_RESTRICTIVE => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | MINIMALLY_RESTRICTIVE => 5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 7 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 7 | my %recommended_script = map { $_ => \1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Common Inherited Arabic Armenian Bengali Bopomofo Cyrillic Devanagari | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Ethiopic Georgian Greek Gujarati Gurmukhi Han Hangul Hebrew Hiragana | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | Kannada Katakana Khmer Lao Latin Malayalam Myanmar Oriya Sinhala Tamil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | Telugu Thaana Thai Tibetan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 7 | my %aspirational_script = map { $_ => \1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Canadian_Aboriginal Miao Mongolian Tifinagh Yi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 7 | my %highly_restrictive = map { $_ => \1 } ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | '', 'Hiragana', 'Katakana', 'Hiragana, Katakana', 'Bopomofo', 'Hangul', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub skeleton { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | ▶ | my $str = NFD shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skeleton: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 10 | ▶ | my $m = $str =~ s{(.)}{ my $c = $MA{$1}; defined $c ? $c : $1 }eg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 10 | ▶ | return $m ? NFD $str : $str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | sub confusable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 5 | ▶ | return skeleton($_[0]) eq skeleton($_[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
confusable: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # Algorithm described here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # http://www.unicode.org/reports/tr39/#Whole_Script_Confusables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | sub whole_script_confusable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | ▶ | my ($target, $str) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
whole_script_confusable: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Canonicalize the script name to match the format used in %WS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 3 | $target = ucfirst lc $target; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 3 | my %soss = soss(NFD $str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 3 | delete @soss{qw(Common Inherited)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | my $count = keys %soss or return ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | ▶ | return if 1 < $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | my ($source) = keys %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | my $chars = $WS{$source}{$target}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | ▶ | do { return 1 if $chars->{$_} } for keys %{ $soss{$source} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | *ws_confusable = *ws_confusable = \&whole_script_confusable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Algorithm described here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # http://www.unicode.org/reports/tr39/#Mixed_Script_Confusables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | sub mixed_script_confusable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 3 | ▶ | my %soss = soss(NFD $_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mixed_script_confusable: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 3 | delete @soss{qw(Common Inherited)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | my @soss = keys %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 3 | for my $source (@soss) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 5 | my $sum = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 5 | for my $target (@soss) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 11 | ▶ | next if $target eq $source; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | my $nok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | my $chars = $WS{$target}{$source}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 7 | for my $char (keys %{ $soss{$target} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 10 | ▶ | $nok = 1, last unless $chars->{$char}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 7 | ▶ | last if $nok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | $sum++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | ▶ | return 1 if 1 == @soss - $sum; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 7 | *ms_confusable = *ms_confusable = \&mixed_script_confusable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | sub soss { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 24 | ▶ | my %soss; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
soss: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 24 | for my $char (split //, $_[0]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 146 | my $script = charscript(ord($char)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 146 | ▶ | $script = 'Unknown' unless defined $script; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 146 | $soss{$script}{$char} = \1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 24 | return %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sub mixed_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | ▶ | my %soss = soss($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mixed_script: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | delete @soss{qw(Common Inherited)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | return 1 < keys %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | sub mixed_number { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 7 | ▶ | my %z; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mixed_number: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 7 | for my $char (split //, $_[0]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 36 | ▶ | my $info = charinfo(ord $char) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 36 | my $num = $info->{decimal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 36 | ▶ | next unless length $num; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 28 | $z{ ord($char) - $num } = \1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | return 1 < keys %z; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 7 | *mixed_num = *mixed_num = \&mixed_number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # Algorithm described here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # http://www.unicode.org/reports/tr39/#Restriction_Level_Detection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | sub restriction_level { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 17 | ▶ | my ($str, $non_id_regex) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restriction_level: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 17 | ▶ | $non_id_regex = qr/\P{ID_Continue}/ unless defined $non_id_regex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 17 | ▶ | return UNRESTRICTED if $str =~ /$non_id_regex/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 16 | ▶ | return ASCII_ONLY if $str !~ /\P{ASCII}/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 14 | my %soss = soss($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 14 | delete @soss{qw(Common Inherited)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 14 | ▶ | return SINGLE_SCRIPT if 1 == keys %soss; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 13 | delete $soss{Latin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 13 | my %copy = %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 13 | delete $copy{Han}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 13 | my $soss = join ', ', sort keys %copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 13 | ▶ | return HIGHLY_RESTRICTIVE if $highly_restrictive{$soss}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 6 | ▶ | if (1 == keys %soss) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | my ($script) = keys %soss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | return MODERATELY_RESTRICTIVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | if ($recommended_script{$script} or $aspirational_script{$script}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 6 | ▶ | and not ($soss{Cyrillic} or $soss{Greek}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$recommended_script{$script} || $aspirational_script{$script} and not $soss{"Cyrillic"} || $soss{"Greek"}
$recommended_script{$script} or $aspirational_script{$script}
$soss{'Cyrillic'} || $soss{'Greek'}
MC/DC50%2/4
$recommended_script{$script} || $aspirational_script{$script} and not $soss{"Cyrillic"} || $soss{"Greek"}
$recommended_script{$script}
$aspirational_script{$script}
$soss{'Cyrillic'}
$soss{'Greek'}
Truth table57%4/7
A or B and not(C || D)
A= $recommended_script{$script}B= $aspirational_script{$script}C= $soss{'Cyrillic'}D= $soss{'Greek'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 4 | return MINIMALLY_RESTRICTIVE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||