| 1 | #-*- perl -*- | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | package Unicode::LineBreak; | ||||||||||||||||||||||||||||||||||||||
| 4 | 21 | require 5.008; | |||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | ### Pragmas: | ||||||||||||||||||||||||||||||||||||||
| 7 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 21 | ▶ | use vars qw($VERSION @EXPORT_OK @ISA $Config @Config); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | ### Exporting: | ||||||||||||||||||||||||||||||||||||||
| 12 | 21 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 13 | 21 | our @EXPORT_OK = qw(UNICODE_VERSION SOMBOK_VERSION context); | |||||||||||||||||||||||||||||||||||||
| 14 | 21 | our %EXPORT_TAGS = ('all' => [@EXPORT_OK]); | |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||
| 16 | ### Inheritance: | ||||||||||||||||||||||||||||||||||||||
| 17 | 21 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||
| 19 | ### Other modules: | ||||||||||||||||||||||||||||||||||||||
| 20 | 21 | ▶ | use Carp qw(croak carp); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 21 | 21 | ▶ | use Encode qw(is_utf8); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 22 | 21 | ▶ | use MIME::Charset; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 23 | 21 | ▶ | use Unicode::GCString; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||
| 25 | ### Globals | ||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||
| 27 | ### The package version | ||||||||||||||||||||||||||||||||||||||
| 28 | 21 | our $VERSION = '2016.007_02'; | |||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||
| 30 | ### Public Configuration Attributes | ||||||||||||||||||||||||||||||||||||||
| 31 | 21 | our @Config = ( | |||||||||||||||||||||||||||||||||||||
| 32 | BreakIndent => 'YES', | ||||||||||||||||||||||||||||||||||||||
| 33 | CharMax => 998, | ||||||||||||||||||||||||||||||||||||||
| 34 | ColMax => 76, | ||||||||||||||||||||||||||||||||||||||
| 35 | ColMin => 0, | ||||||||||||||||||||||||||||||||||||||
| 36 | ComplexBreaking => 'YES', | ||||||||||||||||||||||||||||||||||||||
| 37 | Context => 'NONEASTASIAN', | ||||||||||||||||||||||||||||||||||||||
| 38 | EAWidth => undef, | ||||||||||||||||||||||||||||||||||||||
| 39 | Format => 'SIMPLE', | ||||||||||||||||||||||||||||||||||||||
| 40 | HangulAsAL => 'NO', | ||||||||||||||||||||||||||||||||||||||
| 41 | LBClass => undef, | ||||||||||||||||||||||||||||||||||||||
| 42 | LegacyCM => 'YES', | ||||||||||||||||||||||||||||||||||||||
| 43 | Newline => "\n", | ||||||||||||||||||||||||||||||||||||||
| 44 | Prep => undef, | ||||||||||||||||||||||||||||||||||||||
| 45 | Sizing => 'UAX11', | ||||||||||||||||||||||||||||||||||||||
| 46 | Urgent => undef, | ||||||||||||||||||||||||||||||||||||||
| 47 | ViramaAsJoiner => 'YES', | ||||||||||||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||||||||||||
| 49 | 21 | our $Config = {}; | |||||||||||||||||||||||||||||||||||||
| 50 | 21 | eval { require Unicode::LineBreak::Defaults; }; | |||||||||||||||||||||||||||||||||||||
| 51 | 21 | push @Config, (%$Config); | |||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | ### Exportable constants | ||||||||||||||||||||||||||||||||||||||
| 54 | 21 | ▶ | use Unicode::LineBreak::Constants; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 55 | 21 | ▶ | use constant 1.01; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 56 | 21 | my $package = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||
| 57 | 21 | my @consts = grep { s/^${package}::(\w\w+)$/$1/ } keys %constant::declared; | |||||||||||||||||||||||||||||||||||||
| 58 | 21 | push @EXPORT_OK, @consts; | |||||||||||||||||||||||||||||||||||||
| 59 | 21 | push @{$EXPORT_TAGS{'all'}}, @consts; | |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | ### Load XS module | ||||||||||||||||||||||||||||||||||||||
| 62 | 21 | require XSLoader; | |||||||||||||||||||||||||||||||||||||
| 63 | 21 | XSLoader::load('Unicode::LineBreak', $VERSION); | |||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||
| 65 | ### Load dynamic constants | ||||||||||||||||||||||||||||||||||||||
| 66 | 21 | foreach my $p ((['EA', EAWidths()], ['LB', LBClasses()])) { | |||||||||||||||||||||||||||||||||||||
| 67 | 42 | my $prop = shift @{$p}; | |||||||||||||||||||||||||||||||||||||
| 68 | 42 | my $idx = 0; | |||||||||||||||||||||||||||||||||||||
| 69 | 42 | foreach my $val (@{$p}) { | |||||||||||||||||||||||||||||||||||||
| 70 | 21 | ▶ | no strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 71 | 1029 | my $const = "${prop}_${val}"; | |||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | *{$const} = eval "sub { $idx }"; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.0
| |||||||||||||||||||||||||||||||||||||||
| 73 | 1029 | push @EXPORT_OK, $const; | |||||||||||||||||||||||||||||||||||||
| 74 | 1029 | push @{$EXPORT_TAGS{'all'}}, $const; | |||||||||||||||||||||||||||||||||||||
| 75 | 1029 | $idx++; | |||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||
| 79 | ### Privates | ||||||||||||||||||||||||||||||||||||||
| 80 | 21 | my $EASTASIAN_CHARSETS = qr{ | |||||||||||||||||||||||||||||||||||||
| 81 | ^BIG5 | | ||||||||||||||||||||||||||||||||||||||
| 82 | ^CP9\d\d | | ||||||||||||||||||||||||||||||||||||||
| 83 | ^EUC- | | ||||||||||||||||||||||||||||||||||||||
| 84 | ^GB18030 | ^GB2312 | ^GBK | | ||||||||||||||||||||||||||||||||||||||
| 85 | ^HZ | | ||||||||||||||||||||||||||||||||||||||
| 86 | ^ISO-2022- | | ||||||||||||||||||||||||||||||||||||||
| 87 | ^KS_C_5601 | | ||||||||||||||||||||||||||||||||||||||
| 88 | ^SHIFT_JIS | ||||||||||||||||||||||||||||||||||||||
| 89 | }ix; | ||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||
| 91 | 21 | my $EASTASIAN_LANGUAGES = qr{ | |||||||||||||||||||||||||||||||||||||
| 92 | ^AIN | | ||||||||||||||||||||||||||||||||||||||
| 93 | ^JA\b | ^JPN | | ||||||||||||||||||||||||||||||||||||||
| 94 | ^KO\b | ^KOR | | ||||||||||||||||||||||||||||||||||||||
| 95 | ^ZH\b | ^CHI | ||||||||||||||||||||||||||||||||||||||
| 96 | }ix; | ||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||
| 98 | use overload | ||||||||||||||||||||||||||||||||||||||
| 99 | 21 | '%{}' => \&as_hashref, | |||||||||||||||||||||||||||||||||||||
| 100 | '${}' => \&as_scalarref, | ||||||||||||||||||||||||||||||||||||||
| 101 | '""' => \&as_string, | ||||||||||||||||||||||||||||||||||||||
| 102 | 21 | ▶ | ; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||
| 104 | sub new { | ||||||||||||||||||||||||||||||||||||||
| 105 | 482 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||
| 107 | 482 | my $self = __PACKAGE__->_new(); | |||||||||||||||||||||||||||||||||||||
| 108 | 482 | $self->config(@Config); | |||||||||||||||||||||||||||||||||||||
| 109 | 482 | $self->config(@_); | |||||||||||||||||||||||||||||||||||||
| 110 | 482 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||
| 113 | sub config ($@) { | ||||||||||||||||||||||||||||||||||||||
| 114 | 1385 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
config: called CC=29 SCAR=57.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||
| 116 | # Get config. | ||||||||||||||||||||||||||||||||||||||
| 117 | 1385 | ▶ | if (scalar @_ == 1) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 118 | 348 | my $k = shift; | |||||||||||||||||||||||||||||||||||||
| 119 | 348 | my $ret; | |||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||
| 121 | 348 | ▶ | if (uc $k eq uc 'CharactersMax') { | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return $self->_config('CharMax'); | |||||||||||||||||||||||||||||||||||||
| 123 | } elsif (uc $k eq uc 'ColumnsMax') { | ||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return $self->_config('ColMax'); | |||||||||||||||||||||||||||||||||||||
| 125 | } elsif (uc $k eq uc 'ColumnsMin') { | ||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return $self->_config('ColMin'); | |||||||||||||||||||||||||||||||||||||
| 127 | } elsif (uc $k eq uc 'SizingMethod') { | ||||||||||||||||||||||||||||||||||||||
| 128 | 0 | return $self->_config('Sizing'); | |||||||||||||||||||||||||||||||||||||
| 129 | } elsif (uc $k eq uc 'TailorEA') { | ||||||||||||||||||||||||||||||||||||||
| 130 | 0 | carp "$k is obsoleted. Use EAWidth"; | |||||||||||||||||||||||||||||||||||||
| 131 | 0 | $ret = $self->_config('EAWidth'); | |||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (! defined $ret) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return []; | |||||||||||||||||||||||||||||||||||||
| 134 | } else { | ||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return [map { ($_->[0] => $_->[1]) } @{$ret}]; | |||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||
| 137 | } elsif (uc $k eq uc 'TailorLB') { | ||||||||||||||||||||||||||||||||||||||
| 138 | 0 | carp "$k is obsoleted. Use LBClass"; | |||||||||||||||||||||||||||||||||||||
| 139 | 0 | $ret = $self->_config('LBClass'); | |||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if (! defined $ret) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 141 | 0 | return []; | |||||||||||||||||||||||||||||||||||||
| 142 | } else { | ||||||||||||||||||||||||||||||||||||||
| 143 | 0 | return [map { ($_->[0] => $_->[1]) } @{$ret}]; | |||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||
| 145 | } elsif (uc $k eq uc 'UrgentBreaking') { | ||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return $self->_config('Urgent'); | |||||||||||||||||||||||||||||||||||||
| 147 | } elsif (uc $k eq uc 'UserBreaking') { | ||||||||||||||||||||||||||||||||||||||
| 148 | 0 | carp "$k is obsoleted. Use Prep"; | |||||||||||||||||||||||||||||||||||||
| 149 | 0 | $ret = $self->_config('Prep'); | |||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if (! defined $ret) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return []; | |||||||||||||||||||||||||||||||||||||
| 152 | } else { | ||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||
| 155 | } else { | ||||||||||||||||||||||||||||||||||||||
| 156 | 348 | return $self->_config($k); | |||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||
| 160 | # Set config. | ||||||||||||||||||||||||||||||||||||||
| 161 | 1037 | my @config = (); | |||||||||||||||||||||||||||||||||||||
| 162 | 1037 | ▶ | while (0 < scalar @_) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 163 | 8213 | my $k = shift; | |||||||||||||||||||||||||||||||||||||
| 164 | 8213 | my $v = shift; | |||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||
| 166 | 8213 | ▶ | if (uc $k eq uc 'CharactersMax') { | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 167 | 0 | push @config, 'CharMax' => $v; | |||||||||||||||||||||||||||||||||||||
| 168 | } elsif (uc $k eq uc 'ColumnsMax') { | ||||||||||||||||||||||||||||||||||||||
| 169 | 10 | push @config, 'ColMax' => $v; | |||||||||||||||||||||||||||||||||||||
| 170 | } elsif (uc $k eq uc 'ColumnsMin') { | ||||||||||||||||||||||||||||||||||||||
| 171 | 0 | push @config, 'ColMin' => $v; | |||||||||||||||||||||||||||||||||||||
| 172 | } elsif (uc $k eq uc 'SizingMethod') { | ||||||||||||||||||||||||||||||||||||||
| 173 | 0 | push @config, 'Sizing' => $v; | |||||||||||||||||||||||||||||||||||||
| 174 | } elsif (uc $k eq uc 'TailorLB') { | ||||||||||||||||||||||||||||||||||||||
| 175 | 0 | carp "$k is obsoleted. Use LBClass"; | |||||||||||||||||||||||||||||||||||||
| 176 | 0 | push @config, 'LBClass' => undef; | |||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if (! defined $v) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 178 | ; | ||||||||||||||||||||||||||||||||||||||
| 179 | } else { | ||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my @v = @{$v}; | |||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | while (scalar(@v)) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $k = shift @v; | |||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $v = shift @v; | |||||||||||||||||||||||||||||||||||||
| 184 | 0 | push @config, 'LBClass' => [ $k => $v ]; | |||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||
| 187 | } elsif (uc $k eq uc 'TailorEA') { | ||||||||||||||||||||||||||||||||||||||
| 188 | 0 | carp "$k is obsoleted. Use EAWidth"; | |||||||||||||||||||||||||||||||||||||
| 189 | 0 | push @config, 'EAWidth' => undef; | |||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if (! defined $v) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 191 | ; | ||||||||||||||||||||||||||||||||||||||
| 192 | } else { | ||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my @v = @{$v}; | |||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | while (scalar(@v)) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $k = shift @v; | |||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $v = shift @v; | |||||||||||||||||||||||||||||||||||||
| 197 | 0 | push @config, 'EAWidth' => [ $k => $v ]; | |||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||
| 200 | } elsif (uc $k eq uc 'UserBreaking') { | ||||||||||||||||||||||||||||||||||||||
| 201 | 0 | carp "$k is obsoleted. Use Prep"; | |||||||||||||||||||||||||||||||||||||
| 202 | 0 | push @config, 'Prep' => undef; | |||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if (! defined $v) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 204 | ; | ||||||||||||||||||||||||||||||||||||||
| 205 | } elsif (ref $v eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||
| 206 | 0 | push @config, map { ('Prep' => $_) } @{$v}; | |||||||||||||||||||||||||||||||||||||
| 207 | } else { | ||||||||||||||||||||||||||||||||||||||
| 208 | 0 | push @config, 'Prep' => $v; | |||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||
| 210 | } elsif (uc $k eq uc 'UrgentBreaking') { | ||||||||||||||||||||||||||||||||||||||
| 211 | 0 | push @config, 'Urgent' => $v; | |||||||||||||||||||||||||||||||||||||
| 212 | } else { | ||||||||||||||||||||||||||||||||||||||
| 213 | 8203 | push @config, $k => $v; | |||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||
| 217 | 1037 | ▶ | $self->_config(@config) if scalar @config; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||
| 220 | sub context (@) { | ||||||||||||||||||||||||||||||||||||||
| 221 | 7 | ▶ | my %opts = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
context: called CC=9 SCAR=25.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||
| 223 | 7 | my $charset; | |||||||||||||||||||||||||||||||||||||
| 224 | my $language; | ||||||||||||||||||||||||||||||||||||||
| 225 | 7 | my $context; | |||||||||||||||||||||||||||||||||||||
| 226 | 7 | foreach my $k (keys %opts) { | |||||||||||||||||||||||||||||||||||||
| 227 | 14 | ▶ | if (uc $k eq 'CHARSET') { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 228 | 7 | ▶ | if (ref $opts{$k}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $charset = $opts{$k}->as_string; | |||||||||||||||||||||||||||||||||||||
| 230 | } else { | ||||||||||||||||||||||||||||||||||||||
| 231 | 7 | $charset = MIME::Charset->new($opts{$k})->as_string; | |||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||
| 233 | } elsif (uc $k eq 'LANGUAGE') { | ||||||||||||||||||||||||||||||||||||||
| 234 | 7 | $language = uc $opts{$k}; | |||||||||||||||||||||||||||||||||||||
| 235 | 7 | $language =~ s/_/-/; | |||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||
| 238 | 7 | ▶ | if ($charset and $charset =~ /$EASTASIAN_CHARSETS/) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$charset and $charset =~ /$EASTASIAN_CHARSETS/
MC/DC0%0/2
$charset and $charset =~ /$EASTASIAN_CHARSETS/
$charset
$charset =~ /$EASTASIAN_CHARSETS/
Truth table33%1/3
A and B
A= $charsetB= $charset =~ /$EASTASIAN_CHARSETS/
| |||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $context = 'EASTASIAN'; | |||||||||||||||||||||||||||||||||||||
| 240 | ▶ | } elsif ($language and $language =~ /$EASTASIAN_LANGUAGES/) { | |||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$language and $language =~ /$EASTASIAN_LANGUAGES/
MC/DC0%0/2
$language and $language =~ /$EASTASIAN_LANGUAGES/
$language
$language =~ /$EASTASIAN_LANGUAGES/
Truth table33%1/3
A and B
A= $languageB= $language =~ /$EASTASIAN_LANGUAGES/
| |||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $context = 'EASTASIAN'; | |||||||||||||||||||||||||||||||||||||
| 242 | } else { | ||||||||||||||||||||||||||||||||||||||
| 243 | 7 | $context = 'NONEASTASIAN'; | |||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||
| 245 | 7 | $context; | |||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||
| 248 | 21 | 1; | |||||||||||||||||||||||||||||||||||||