blib/lib/HTML/AA.pm

filter: Statementstmt 4.8% 17 / 354 Branchbran 0.0% 0 / 266 Conditioncond 0.0% 0 / 30 MC/DCmcdc 0.0% 0 / 17 Subroutinesub 13.6% 3 / 22 Podpod 0.0% 0 / 19 totaltotal 2.8% 20 / 708 CC 153 SCAR 57.8
CC
153
Cov
3%
calcu_euc
650.0
calcu_sjis
600.0
adjust_right_euc
342.0
CRAP 323.8
↑ Summary
1 package HTML::AA;
2
3 1 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 1 require Exporter;
8
9 1 our @ISA = qw(Exporter);
10 1 our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
11 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
12 1 our @EXPORT = qw( );
13 1 our $VERSION = '0.10';
14 #-------------------------------------------------------------------------------
15 # Module declaration
16 #-------------------------------------------------------------------------------
17 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
18 0 my $self = {};
19 0 bless $self;
20 0 return $self;
21 }
22 #-------------------------------------------------------------------------------
23 # The character-code is declared.
24 #-------------------------------------------------------------------------------
25 1 my $code = 'euc';
26 #-------------------------------------------------------------------------------
27 # The character-code that the module processes is declared.
28 # It is effective in the call that doesn't specify the character-code.
29 # If it wants to process it with EUC-JP, it is euc.
30 # $aart -> code('euc');
31 # If it wants to process it with Shift_JIS, it is sjis.
32 # $aart -> code('sjis');
33 #-------------------------------------------------------------------------------
34 0 ▶sub code {
Subroutine code: not called CC=1 SCAR=6.9
Pod undocumented
35 0 my $self = shift;
36 0 $code = shift;
37 }
38 #-------------------------------------------------------------------------------
39 # The number of dots is calculated.
40 # $aart -> calcu($str);
41 #-------------------------------------------------------------------------------
42 0 ▶sub calcu {
Subroutine calcu: not called CC=3 SCAR=24.8
Pod undocumented
43 0 my $self = shift;
44 0 my $str = shift;
45
46 0 ▶ return $self -> calcu_euc($str) if $code eq 'euc';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" 0 0 0
47 0 ▶ return $self -> calcu_sjis($str) if $code eq 'sjis';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" 0 0 0
48 }
49 # When you want to process it with EUC-JP disregarding the character-code declaration
50 # $aart -> calcu_euc($str);
51 0 ▶sub calcu_euc {
Subroutine calcu_euc: not called CC=25 SCAR=64.8
Pod undocumented
52 0 my $self = shift;
53 0 my $str = shift;
54
55 0 my $count = 0;
56
57 0 foreach ( $self -> divide_euc($str) ) {
58 #------------------- 2 bytes
59 0 ▶ if ($_ =~ /../) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /../) { } 0 0 0
60 0 ▶ if ($_ =~ /\xa1\xbc|\xa3\xcd|\xa3\xed|\xa4\xa2|\xa4\xa4|\xa4\xaa|\xa4\xb1|\xa4\xb9|\xa4\xbd|\xa4\xbe|\xa4\xbf|\xa4\xc0|\xa4\xc4|\xa4\xc5|\xa4\xcb|\xa4\xd2|\xa4\xd3|\xa4\xd4|\xa4\xf3|\xa5\xa6|\xa5\xaa|\xa5\xac|\xa5\xad|\xa5\xae|\xa5\xb0|\xa5\xb1|\xa5\xb2|\xa5\xba|\xa5\xbb|\xa5\xc0|\xa5\xc1|\xa5\xc2|\xa5\xc5|\xa5\xc7|\xa5\xca|\xa5\xcb|\xa5\xcd|\xa5\xd8|\xa5\xd9|\xa5\xda|\xa5\xdb|\xa5\xdc|\xa5\xdd|\xa5\xe6|\xa5\xef|\xa5\xf4/){
Branch: 12 branches
BranchTrueFalseTotal
if ($_ =~ /\xa1\xbc|\xa3\xcd|\xa3\xed|\xa4\xa2|\xa4\xa4|\xa4\xaa|\xa4\xb1|\xa4\xb9|\xa4\xbd|\xa4\xbe|\xa4\xbf|\xa4\xc0|\xa4\xc4|\xa4\xc5|\xa4\xcb|\xa4\xd2|\xa4\xd3|\xa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_ =~ /\xa3\xf2/){
88 0 $count += 6;
89 }
90 elsif ($_ =~ /\xa3\xe6|\xa3\xf4/){
91 0 $count += 5;
92 }
93 elsif ($_ =~ /\x8e\xde|\x8e\xdf|\xa3\xc9|\xa3\xe9|\xa3\xea|\xa3\xec/){
94 0 $count += 4;
95 }
96 # There is no character of 3 dots.
97 else {
98 0 $count += 16;
99 }
100 }
101 #------------------- 1byte
102 else {
103 # There is no character of 15 dots.
104 # There is no character of 14 dots.
105 # There is no character of 13 dots.
106 0 ▶ if ($_ =~ /\x4d|\x57|\x6d/){
Branch: 10 branches
BranchTrueFalseTotal
if ($_ =~ /\x4d|\x57|\x6d/) { } 0 0 0
elsif ($_ =~ /\x40|\x43|\x47|\x4f|\x51/) { } 0 0 0
elsif ($_ =~ /\x26|\x41|\x42|\x44|\x48|\x4b|\x4e|\x50|\x52|\x53|\x55|\x56|\x58|\x77/) { } 0 0 0
elsif ($_ =~ /\x45|\x46|\x4a|\x4c|\x54|\x59|\x5a/) { } 0 0 0
elsif ($_ =~ /\x61|\x62|\x63|\x64|\x65|\x68|\x6e|\x6f|\x70|\x71|\x75|\x76|\x79|\x22|\x23|\x24|\x25|\x2a|\x2b|\x2d|\x2f|\x30|\x31|\x32|\x33|\x34|\x35|\x36|\x37|\x38|\x39|\x3c|\x3d|\x3e|\x5c/) { } 0 0 0
elsif ($_ =~ /\x3f|\x5e|\x60|\x67|\x6b|\x73|\x78|\x7a|\x7e/) { } 0 0 0
elsif ($_ =~ /\x72|\x74/) { } 0 0 0
elsif ($_ =~ /\x28|\x29|\x5b|\x5d|\x5f|\x66|\x20/) { } 0 0 0
elsif ($_ =~ /\x21|\x49|\x6a|\x7b|\x7c|\x7d/) { } 0 0 0
elsif ($_ =~ /\x27|\x2c|\x2e|\x3a|\x3b|\x69|\x6c/) { } 0 0 0
107 0 $count += 12;
108 }
109 elsif ($_ =~ /\x40|\x43|\x47|\x4f|\x51/){
110 0 $count += 11;
111 }
112 elsif ($_ =~ /\x26|\x41|\x42|\x44|\x48|\x4b|\x4e|\x50|\x52|\x53|\x55|\x56|\x58|\x77/){
113 0 $count += 10;
114 }
115 elsif ($_ =~ /\x45|\x46|\x4a|\x4c|\x54|\x59|\x5a/){
116 0 $count += 9;
117 }
118 elsif ($_ =~ /\x61|\x62|\x63|\x64|\x65|\x68|\x6e|\x6f|\x70|\x71|\x75|\x76|\x79|\x22|\x23|\x24|\x25|\x2a|\x2b|\x2d|\x2f|\x30|\x31|\x32|\x33|\x34|\x35|\x36|\x37|\x38|\x39|\x3c|\x3d|\x3e|\x5c/){
119 0 $count += 8;
120 }
121 elsif ($_ =~ /\x3f|\x5e|\x60|\x67|\x6b|\x73|\x78|\x7a|\x7e/){
122 0 $count += 7;
123 }
124 elsif ($_ =~ /\x72|\x74/){
125 0 $count += 6;
126 }
127 elsif ($_ =~ /\x28|\x29|\x5b|\x5d|\x5f|\x66|\x20/){
128 0 $count += 5;
129 }
130 elsif ($_ =~ /\x21|\x49|\x6a|\x7b|\x7c|\x7d/){
131 0 $count += 4;
132 }
133 elsif ($_ =~ /\x27|\x2c|\x2e|\x3a|\x3b|\x69|\x6c/){
134 0 $count += 3;
135 }
136 }
137 }
138
139 0 return $count;
140 }
141 # When you want to process it with Shift_JIS disregarding the character-code declaration
142 # $aart -> calcu_sjis($str);
143 0 ▶sub calcu_sjis {
Subroutine calcu_sjis: not called CC=24 SCAR=64.0
Pod undocumented
144 0 my $self = shift;
145 0 my $str = shift;
146
147 0 my $count = 0;
148
149 0 foreach ( $self -> divide_sjis($str) ) {
150 #------------------- 2 bytes
151 0 ▶ if ($_ =~ /../) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /../) { } 0 0 0
152 0 ▶ if ($_ =~ /\x81\x5b|\x82\x6c|\x82\x8d|\x82\xa0|\x82\xa2|\x82\xa8|\x82\xaf|\x82\xb7|\x82\xbb|\x82\xbc|\x82\xbd|\x82\xbe|\x82\xc2|\x82\xc3|\x82\xc9|\x82\xd0|\x82\xd1|\x82\xd2|\x82\xf1|\x83\x45|\x83\x49|\x83\x4b|\x83\x4c|\x83\x4d|\x83\x4f|\x83\x50|\x83\x51|\x83\x59|\x83\x5a|\x83\x5f|\x83\x60|\x83\x61|\x83\x64|\x83\x66|\x83\x69|\x83\x6a|\x83\x6c|\x83\x77|\x83\x78|\x83\x79|\x83\x7a|\x83\x7b|\x83\x7c|\x83\x86|\x83\x8f|\x83\x94/){
Branch: 11 branches
BranchTrueFalseTotal
if ($_ =~ /\x81\x5b|\x82\x6c|\x82\x8d|\x82\xa0|\x82\xa2|\x82\xa8|\x82\xaf|\x82\xb7|\x82\xbb|\x82\xbc|\x82\xbd|\x82\xbe|\x82\xc2|\x82\xc3|\x82\xc9|\x82\xd0|\x82\xd1|\x82\xd2|\x82\xf1|\x83\x45|\x83\x49|\x83\x4b|\x83\x4c|\x83\x4d|\x83\x4f|\x83\x50|\x83\x51|\x83\x59|\x83\x5a|\x83\x5f|\x83\x60|\x83\x61|\x83\x64|\x83\x66|\x83\x69|\x83\x6a|\x83\x6c|\x83\x77|\x83\x78|\x83\x79|\x83\x7a|\x83\x7b|\x83\x7c|\x83\x86|\x83\x8f|\x83\x94/) { } 0 0 0
elsif ($_ =~ /\x82\xa6|\x82\xab|\x82\xac|\x82\xb2|\x82\xb4|\x82\xbf|\x82\xc0|\x82\xc4|\x82\xc5|\x82\xc7|\x82\xc8|\x82\xdc|\x82\xe1|\x82\xe3|\x82\xe6|\x82\xe9|\x82\xeb|\x82\xec|\x82\xf0|\x83\x41|\x83\x47|\x83\x53|\x83\x56|\x83\x57|\x83\x58|\x83\x5d|\x83\x63|\x83\x65|\x83\x72|\x83\x73|\x83\x75|\x83\x76|\x83\x7d|\x83\x82|\x83\x8c|\x83\x8d|\x83\x93/) { } 0 0 0
elsif ($_ =~ /\x82\x6e|\x82\x70|\x82\xa1|\x82\xa7|\x82\xae|\x82\xb1|\x82\xc1|\x82\xe0|\x82\xe7|\x83\x43|\x83\x48|\x83\x4a|\x83\x4e|\x83\x52|\x83\x5c|\x83\x6b|\x83\x74|\x83\x83|\x83\x85|\x83\x89|\x83\x92/) { } 0 0 0
elsif ($_ =~ /\x81\x52|\x81\x53|\x81\x54|\x82\x61|\x82\x62|\x82\x63|\x82\x66|\x82\x67|\x82\x6a|\x82\x6d|\x82\x71|\x82\x72|\x82\x74|\x82\x97|\x82\x9f|\x82\xa5|\x82\xb3|\x82\xb5|\x82\xb6|\x82\xc6|\x82\xe5|\x82\xe8|\x83\x40|\x83\x44|\x83\x46|\x83\x5e|\x83\x62|\x83\x71|\x83\x81|\x83\x88|\x83\x8a|\x83\x8e|\x83\x95|\x83\x96/) { } 0 0 0
elsif ($_ =~ /\x81\x41|\x81\x42|\x81\x43|\x81\x44|\x81\x55|\x82\x4f|\x82\x50|\x82\x51|\x82\x52|\x82\x53|\x82\x54|\x82\x55|\x82\x56|\x82\x57|\x82\x58|\x82\x60|\x82\x64|\x82\x6f|\x82\x75|\x82\xa4|\x83\x68|\x83\x6d|\x83\x7e|\x81\x40/) { } 0 0 0
elsif ($_ =~ /\x82\x65|\x82\x69|\x82\x6b|\x82\x73|\x82\x77|\x82\x78|\x82\x79|\x82\x82|\x82\x84|\x82\x88|\x82\x8b|\x82\x8e|\x82\x8f|\x82\x90|\x82\x91|\x82\x95|\x82\xa3|\x83\x42|\x83\x67|\x83\x87/) { } 0 0 0
elsif ($_ =~ /\x82\x81|\x82\x83|\x82\x85|\x82\x87|\x82\x93|\x82\xad/) { } 0 0 0
elsif ($_ =~ /\x81\x45|\x81\x46|\x81\x47|\x81\x4a|\x81\x4b|\x81\x4c|\x81\x4d|\x81\x4e|\x81\x4f|\x81\x5d|\x81\x65|\x81\x66|\x81\x67|\x81\x68|\x81\x69|\x81\x6a|\x81\x6b|\x81\x6c|\x81\x6d|\x81\x6e|\x81\x6f|\x81\x70|\x81\x71|\x81\x72|\x81\x73|\x81\x74|\x81\x75|\x81\x76|\x81\x77|\x81\x78|\x81\x79|\x81\x7a|\x81\xf5|\x81\xf6|\x81\xf7|\x82\x96|\x82\x98|\x82\x99|\x82\x9a/) { } 0 0 0
elsif ($_ =~ /\x82\x92/) { } 0 0 0
elsif ($_ =~ /\x82\x86|\x82\x94/) { } 0 0 0
elsif ($_ =~ /\x82\x68|\x82\x89|\x82\x8a|\x82\x8c/) { } 0 0 0
153 0 $count += 15;
154 }
155 elsif ($_ =~ /\x82\xa6|\x82\xab|\x82\xac|\x82\xb2|\x82\xb4|\x82\xbf|\x82\xc0|\x82\xc4|\x82\xc5|\x82\xc7|\x82\xc8|\x82\xdc|\x82\xe1|\x82\xe3|\x82\xe6|\x82\xe9|\x82\xeb|\x82\xec|\x82\xf0|\x83\x41|\x83\x47|\x83\x53|\x83\x56|\x83\x57|\x83\x58|\x83\x5d|\x83\x63|\x83\x65|\x83\x72|\x83\x73|\x83\x75|\x83\x76|\x83\x7d|\x83\x82|\x83\x8c|\x83\x8d|\x83\x93/){
156 0 $count += 14;
157 }
158 elsif ($_ =~ /\x82\x6e|\x82\x70|\x82\xa1|\x82\xa7|\x82\xae|\x82\xb1|\x82\xc1|\x82\xe0|\x82\xe7|\x83\x43|\x83\x48|\x83\x4a|\x83\x4e|\x83\x52|\x83\x5c|\x83\x6b|\x83\x74|\x83\x83|\x83\x85|\x83\x89|\x83\x92/){
159 0 $count += 13;
160 }
161 elsif ($_ =~ /\x81\x52|\x81\x53|\x81\x54|\x82\x61|\x82\x62|\x82\x63|\x82\x66|\x82\x67|\x82\x6a|\x82\x6d|\x82\x71|\x82\x72|\x82\x74|\x82\x97|\x82\x9f|\x82\xa5|\x82\xb3|\x82\xb5|\x82\xb6|\x82\xc6|\x82\xe5|\x82\xe8|\x83\x40|\x83\x44|\x83\x46|\x83\x5e|\x83\x62|\x83\x71|\x83\x81|\x83\x88|\x83\x8a|\x83\x8e|\x83\x95|\x83\x96/){
162 0 $count += 12;
163 }
164 elsif ($_ =~ /\x81\x41|\x81\x42|\x81\x43|\x81\x44|\x81\x55|\x82\x4f|\x82\x50|\x82\x51|\x82\x52|\x82\x53|\x82\x54|\x82\x55|\x82\x56|\x82\x57|\x82\x58|\x82\x60|\x82\x64|\x82\x6f|\x82\x75|\x82\xa4|\x83\x68|\x83\x6d|\x83\x7e|\x81\x40/){
165 0 $count += 11;
166 }
167 elsif ($_ =~ /\x82\x65|\x82\x69|\x82\x6b|\x82\x73|\x82\x77|\x82\x78|\x82\x79|\x82\x82|\x82\x84|\x82\x88|\x82\x8b|\x82\x8e|\x82\x8f|\x82\x90|\x82\x91|\x82\x95|\x82\xa3|\x83\x42|\x83\x67|\x83\x87/){
168 0 $count += 10;
169 }
170 elsif ($_ =~ /\x82\x81|\x82\x83|\x82\x85|\x82\x87|\x82\x93|\x82\xad/){
171 0 $count += 9;
172 }
173 elsif ($_ =~ /\x81\x45|\x81\x46|\x81\x47|\x81\x4a|\x81\x4b|\x81\x4c|\x81\x4d|\x81\x4e|\x81\x4f|\x81\x5d|\x81\x65|\x81\x66|\x81\x67|\x81\x68|\x81\x69|\x81\x6a|\x81\x6b|\x81\x6c|\x81\x6d|\x81\x6e|\x81\x6f|\x81\x70|\x81\x71|\x81\x72|\x81\x73|\x81\x74|\x81\x75|\x81\x76|\x81\x77|\x81\x78|\x81\x79|\x81\x7a|\x81\xf5|\x81\xf6|\x81\xf7|\x82\x96|\x82\x98|\x82\x99|\x82\x9a/){
174 0 $count += 8;
175 }
176 # There is no character of 7 dots.
177 elsif ($_ =~ /\x82\x92/){
178 0 $count += 6;
179 }
180 elsif ($_ =~ /\x82\x86|\x82\x94/){
181 0 $count += 5;
182 }
183 elsif ($_ =~ /\x82\x68|\x82\x89|\x82\x8a|\x82\x8c/){
184 0 $count += 4;
185 }
186 # There is no character of 3 dots.
187 else {
188 0 $count += 16;
189 }
190 }
191 #------------------- 1byte
192 else {
193 # There is no character of 15 dots.
194 # There is no character of 14 dots.
195 # There is no character of 13 dots.
196 0 ▶ if ($_ =~ /\x4d|\x57|\x6d/){
Branch: 10 branches
BranchTrueFalseTotal
if ($_ =~ /\x4d|\x57|\x6d/) { } 0 0 0
elsif ($_ =~ /\x40|\x43|\x47|\x4f|\x51|\xbb|\xd1|\xd4|\xd9/) { } 0 0 0
elsif ($_ =~ /\x26|\x41|\x42|\x44|\x48|\x4b|\x4e|\x50|\x52|\x53|\x55|\x56|\x58|\x77|\xb0|\xb1|\xb3|\xb4|\xb5|\xb7|\xb9|\xbd|\xbe|\xc1|\xc2|\xc3|\xc5|\xc6|\xc8|\xca|\xcd|\xce|\xcf|\xd3|\xd5/) { } 0 0 0
elsif ($_ =~ /\x45|\x46|\x4a|\x4c|\x54|\x59|\x5a|\xa6|\xb2|\xb6|\xb8|\xba|\xbc|\xbf|\xc0|\xc7|\xcc|\xd7|\xda|\xdb|\xdc|\xdd/) { } 0 0 0
elsif ($_ =~ /\x61|\x62|\x63|\x64|\x65|\x68|\x6e|\x6f|\x70|\x71|\x75|\x76|\x79|\x22|\x23|\x24|\x25|\x2a|\x2b|\x2d|\x2f|\x30|\x31|\x32|\x33|\x34|\x35|\x36|\x37|\x38|\x39|\x3c|\x3d|\x3e|\x5c|\xa7|\xa9|\xaa|\xab|\xac|\xad|\xaf|\xc9|\xcb|\xd2|\xd6|\xd8/) { } 0 0 0
elsif ($_ =~ /\x3f|\x5e|\x60|\x67|\x6b|\x73|\x78|\x7a|\x7e|\xa2|\xa3|\xa5|\xa8|\xae|\xc4|\xd0|\xa1|\xa4/) { } 0 0 0
elsif ($_ =~ /\x72|\x74/) { } 0 0 0
elsif ($_ =~ /\x28|\x29|\x5b|\x5d|\x5f|\x66|\x20/) { } 0 0 0
elsif ($_ =~ /\x21|\x49|\x6a|\x7b|\x7c|\x7d|\xde|\xdf/) { } 0 0 0
elsif ($_ =~ /\x27|\x2c|\x2e|\x3a|\x3b|\x69|\x6c/) { } 0 0 0
197 0 $count += 12;
198 }
199 elsif ($_ =~ /\x40|\x43|\x47|\x4f|\x51|\xbb|\xd1|\xd4|\xd9/){
200 0 $count += 11;
201 }
202 elsif ($_ =~ /\x26|\x41|\x42|\x44|\x48|\x4b|\x4e|\x50|\x52|\x53|\x55|\x56|\x58|\x77|\xb0|\xb1|\xb3|\xb4|\xb5|\xb7|\xb9|\xbd|\xbe|\xc1|\xc2|\xc3|\xc5|\xc6|\xc8|\xca|\xcd|\xce|\xcf|\xd3|\xd5/){
203 0 $count += 10;
204 }
205 elsif ($_ =~ /\x45|\x46|\x4a|\x4c|\x54|\x59|\x5a|\xa6|\xb2|\xb6|\xb8|\xba|\xbc|\xbf|\xc0|\xc7|\xcc|\xd7|\xda|\xdb|\xdc|\xdd/){
206 0 $count += 9;
207 }
208 elsif ($_ =~ /\x61|\x62|\x63|\x64|\x65|\x68|\x6e|\x6f|\x70|\x71|\x75|\x76|\x79|\x22|\x23|\x24|\x25|\x2a|\x2b|\x2d|\x2f|\x30|\x31|\x32|\x33|\x34|\x35|\x36|\x37|\x38|\x39|\x3c|\x3d|\x3e|\x5c|\xa7|\xa9|\xaa|\xab|\xac|\xad|\xaf|\xc9|\xcb|\xd2|\xd6|\xd8/){
209 0 $count += 8;
210 }
211 elsif ($_ =~ /\x3f|\x5e|\x60|\x67|\x6b|\x73|\x78|\x7a|\x7e|\xa2|\xa3|\xa5|\xa8|\xae|\xc4|\xd0|\xa1|\xa4/){
212 0 $count += 7;
213 }
214 elsif ($_ =~ /\x72|\x74/){
215 0 $count += 6;
216 }
217 elsif ($_ =~ /\x28|\x29|\x5b|\x5d|\x5f|\x66|\x20/){
218 0 $count += 5;
219 }
220 elsif ($_ =~ /\x21|\x49|\x6a|\x7b|\x7c|\x7d|\xde|\xdf/){
221 0 $count += 4;
222 }
223 elsif ($_ =~ /\x27|\x2c|\x2e|\x3a|\x3b|\x69|\x6c/){
224 0 $count += 3;
225 }
226 }
227 }
228
229 0 return $count;
230 }
231 #-------------------------------------------------------------------------------
232 # The variable of the character string is resolved to the array of one character.
233 # $aart -> divide($str);
234 #-------------------------------------------------------------------------------
235 0 ▶sub divide {
Subroutine divide: not called CC=3 SCAR=24.8
Pod undocumented
236 0 my $self = shift;
237 0 my $str = shift;
238
239 0 ▶ return $self -> divide_euc($str) if $code eq 'euc';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" 0 0 0
240 0 ▶ return $self -> divide_sjis($str) if $code eq 'sjis';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" 0 0 0
241 }
242 # When you want to process it with EUC-JP disregarding the character-code declaration
243 # $aart -> divide_euc($str);
244 0 ▶sub divide_euc {
Subroutine divide_euc: not called CC=1 SCAR=6.9
Pod undocumented
245 0 my $self = shift;
246 0 my $str = shift;
247
248 0 my $esc = '[\x00-\x1F]';
249 0 my $oneBytes = '[\x20-\x7E]';
250 0 my $twoBytes1 = '\x8E[\xA1-\xDF]';
251 0 my $twoBytes2 = '[\xA1-\xFE][\xA1-\xFE]';
252 0 my $threeBytes = '\x8F[\xA1-\xFE][\xA1-\xFE]';
253
254 0 $str =~ s/$esc//og;
255 0 my @array = $str =~ /$oneBytes|$twoBytes1|$twoBytes2|$threeBytes/og;
256 0 return @array;
257 }
258 # When you want to process it with Shift_JIS disregarding the character-code declaration
259 # $aart -> divide_sjis($str);
260 0 ▶sub divide_sjis {
Subroutine divide_sjis: not called CC=3 SCAR=24.8
Pod undocumented
261 0 my $self = shift;
262 0 my $str = shift;
263
264 0 my $esc = '[\x00-\x1F]';
265 0 my $oneBytes = '[\x20-\x7E\xA1-\xDF]';
266 0 my $twoBytes1 = '[\x81-\x9F][\x40-\x7E]';
267 0 my $twoBytes2 = '[\xE0-\xEF][\x80-\xFC]';
268
269 0 $str =~ s/$esc//og;
270 0 my @array;
271 0 ▶ while($str) {
Branch: 1 branch
BranchTrueFalseTotal
if ($str) 0 0 0
272 0 $str =~ s/(.)//;
273 0 my $tmp = $1;
274
275 0 ▶ if ($tmp =~ /$oneBytes/og) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tmp =~ /$oneBytes/go) 0 0 0
276 0 push @array , $tmp;
277 0 next;
278 }
279 0 $str =~ s/(.)//;
280 0 $tmp .= $1;
281 0 push @array , $tmp;
282 }
283
284 0 return @array;
285 }
286 #-------------------------------------------------------------------------------
287 # The character string that adds the adjustment dot is returned.
288 # $aart -> adjust($str_l, $str_r, position, $size);
289 #-------------------------------------------------------------------------------
290 0 ▶sub adjust {
Subroutine adjust: not called CC=12 SCAR=50.5
Pod undocumented
291 0 my $self = shift;
292 0 ▶ my $str_l = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
293 0 ▶ my $str_r = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
294 0 ▶ my $position = shift || 'L';
Condition0%0/2
shift() || 'L'
l!l
00
MC/DC0%0/1
shift() || 'L'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
295 0 my $size = shift;
296
297 0 ▶ return $self -> adjust_right_euc($str_l, $str_r, $size) if $code eq 'euc' && $position eq 'R';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" and $position eq "R" 0 0 0
Condition0%0/3
$code eq "euc" and $position eq "R"
!ll&&!rl&&r
000
MC/DC0%0/2
$code eq "euc" and $position eq "R"
$code eq "euc" $position eq "R"
Truth table0%0/3
A and B
A= $code eq "euc"B= $position eq "R"
ABresult
0X0
100
111
298 0 ▶ return $self -> adjust_left_euc($str_l, $str_r, $size) if $code eq 'euc' && $position eq 'L';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" and $position eq "L" 0 0 0
Condition0%0/3
$code eq "euc" and $position eq "L"
!ll&&!rl&&r
000
MC/DC0%0/2
$code eq "euc" and $position eq "L"
$code eq "euc" $position eq "L"
Truth table0%0/3
A and B
A= $code eq "euc"B= $position eq "L"
ABresult
0X0
100
111
299 0 ▶ return $self -> adjust_right_sjis($str_l, $str_r, $size) if $code eq 'sjis' && $position eq 'R';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" and $position eq "R" 0 0 0
Condition0%0/3
$code eq "sjis" and $position eq "R"
!ll&&!rl&&r
000
MC/DC0%0/2
$code eq "sjis" and $position eq "R"
$code eq "sjis" $position eq "R"
Truth table0%0/3
A and B
A= $code eq "sjis"B= $position eq "R"
ABresult
0X0
100
111
300 0 ▶ return $self -> adjust_left_sjis($str_l, $str_r, $size) if $code eq 'sjis' && $position eq 'L';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" and $position eq "L" 0 0 0
Condition0%0/3
$code eq "sjis" and $position eq "L"
!ll&&!rl&&r
000
MC/DC0%0/2
$code eq "sjis" and $position eq "L"
$code eq "sjis" $position eq "L"
Truth table0%0/3
A and B
A= $code eq "sjis"B= $position eq "L"
ABresult
0X0
100
111
301 }
302 # When you want to process it with EUC-JP disregarding the character-code declaration and position 'R'.
303 # $aart -> adjust_right_euc($str_l, $str_r, $size);
304 0 ▶sub adjust_right_euc {
Subroutine adjust_right_euc: not called CC=18 SCAR=58.3
Pod undocumented
305 0 my $self = shift;
306 0 ▶ my $str_l = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
307 0 ▶ my $str_r = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
308 0 my $size = shift;
309 0 my $count = $self -> calcu_euc("$str_l$str_r");
310
311 0 my $diff = $size - $count;
312 0 my $space = int( $diff/11 );
313
314 0 my $set2 = q{};
315 0 ▶ for (my $t = 0; $t < $space; $t ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t < $space) 0 0 0
316 0 $diff -= 11;
317 0 $set2 .= "\xa1\xa1";
318 }
319
320 0 ▶ if ($diff == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 1) 0 0 0
321 0 ▶ if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \xa1\xa1 \xa1\xa1 \xa1\xa1 \./) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \241\241 \241\241 \241\241 ./) { } 0 0 0
322 0 else { $set2 =~ s/\xa1\xa1$/\.\.\.\./; }
323 }
324 0 ▶ if ($diff == 2) { $set2 =~ s/\xa1\xa1\xa1\xa1$/ \xa1\xa1 \./ }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 2) 0 0 0
325 0 ▶ if ($diff == 3) { $set2 .= '.' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 3) 0 0 0
326 0 ▶ if ($diff == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 4) 0 0 0
327 0 ▶ if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1$/ \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1$/ \241\241 \241\241 /) { } 0 0 0
328 0 else { $set2 =~ s/\xa1\xa1$/\.\.\.\.\./; }
329 }
330 0 ▶ if ($diff == 5) { $set2 .= ' ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 5) 0 0 0
331 0 ▶ if ($diff == 6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 6) 0 0 0
332 0 ▶ if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \xa1\xa1 \xa1\xa1 \xa1\xa1 \. /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \241\241 \241\241 \241\241 . /) { } 0 0 0
333 0 else { $set2 .= '..' }
334 }
335 0 ▶ if ($diff == 7) { $set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1$/ \xa1\xa1 \xa1\xa1 \./ }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 7) 0 0 0
336 0 ▶ if ($diff == 8) { $set2 .= ' .' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 8) 0 0 0
337 0 ▶ if ($diff == 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 9) 0 0 0
338 0 ▶ if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \xa1\xa1 \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1$/ \241\241 \241\241 \241\241 /) { } 0 0 0
339 0 else { $set2 .= '...' }
340 }
341 0 ▶ if ($diff == 10) { $set2 =~ s/\xa1\xa1\xa1\xa1$/\xa1\xa1 \xa1\xa1 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 10) 0 0 0
342
343 0 return "$str_l$set2$str_r";
344 }
345 # When you want to process it with EUC-JP disregarding the character-code declaration and position 'L'.
346 # $aart -> adjust_left_euc($str_l, $str_r, $size);
347 0 ▶sub adjust_left_euc {
Subroutine adjust_left_euc: not called CC=16 SCAR=56.1
Pod undocumented
348 0 my $self = shift;
349 0 my $str_l = join q{}, $self -> divide_euc(shift);
350 0 my $str_r = join q{}, $self -> divide_euc(shift);
351 0 my $size = shift;
352
353 0 my $count = $self -> calcu_euc("$str_l$str_r");
354 0 my $diff = $size - $count;
355 0 my $space = int( $diff/11 );
356
357 0 my $set2 = q{};
358 0 ▶ for (my $t = 0; $t < $space; $t ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t < $space) 0 0 0
359 0 $diff -= 11;
360 0 $set2 .= "\xa1\xa1";
361 }
362 0 ▶ if ($diff == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 1) 0 0 0
363 0 ▶ if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/\. \xa1\xa1 \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/. \241\241 \241\241 \241\241 /) { } 0 0 0
364 0 else { $set2 =~ s/^\xa1\xa1/\.\.\.\./; }
365 }
366 0 ▶ if ($diff == 2) { $set2 =~ s/^\xa1\xa1\xa1\xa1/\. \xa1\xa1 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 2) 0 0 0
367 0 ▶ if ($diff == 3) { $set2 = '.'.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 3) 0 0 0
368 0 ▶ if ($diff == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 4) 0 0 0
369 0 ▶ if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1/ \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1/ \241\241 \241\241 /) { } 0 0 0
370 0 else { $set2 =~ s/^\xa1\xa1/\.\.\.\.\./ }
371 }
372 0 ▶ if ($diff == 5) { $set2 = ' '.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 5) 0 0 0
373 0 ▶ if ($diff == 6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 6) 0 0 0
374 0 ▶ if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/ \. \xa1\xa1 \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/ . \241\241 \241\241 \241\241 /) { } 0 0 0
375 0 else { $set2 = '..'.$set2 }
376 }
377 0 ▶ if ($diff == 7) { $set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1/\. \xa1\xa1 \xa1\xa1 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 7) 0 0 0
378 0 ▶ if ($diff == 8) { $set2 = '. '.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 8) 0 0 0
379 0 ▶ if ($diff == 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 9) 0 0 0
380 0 ▶ if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/ \xa1\xa1 \xa1\xa1 \xa1\xa1 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\xa1\xa1\xa1\xa1\xa1\xa1\xa1\xa1/ \241\241 \241\241 \241\241 /) { } 0 0 0
381 0 else { $set2 = '...'.$set2 }
382 }
383 0 ▶ if ($diff == 10) { $set2 =~ s/^\xa1\xa1\xa1\xa1/\xa1\xa1 \xa1\xa1 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 10) 0 0 0
384
385 0 return "$str_l$set2$str_r";
386 }
387 # When you want to process it with Shift_JIS disregarding the character-code declaration and position 'R'.
388 # $aart -> adjust_right_sjis($str_l, $str_r, $size);
389 0 ▶sub adjust_right_sjis {
Subroutine adjust_right_sjis: not called CC=18 SCAR=58.3
Pod undocumented
390 0 my $self = shift;
391 0 ▶ my $str_l = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
392 0 ▶ my $str_r = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
393 0 my $size = shift;
394 0 my $count = $self -> calcu_sjis("$str_l$str_r");
395
396 0 my $diff = $size - $count;
397 0 my $space = int( $diff/11 );
398
399 0 my $set2 = q{};
400 0 ▶ for (my $t = 0; $t < $space; $t ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t < $space) 0 0 0
401 0 $diff -= 11;
402 0 $set2 .= "\x81\x40";
403 }
404
405 0 ▶ if ($diff == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 1) 0 0 0
406 0 ▶ if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40$/ \x81\x40 \x81\x40 \x81\x40 \./) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40$/ \201\@ \201\@ \201\@ ./) { } 0 0 0
407 0 else { $set2 =~ s/\x81\x40$/\.\.\.\./; }
408 }
409 0 ▶ if ($diff == 2) { $set2 =~ s/\x81\x40\x81\x40$/ \x81\x40 \./ }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 2) 0 0 0
410 0 ▶ if ($diff == 3) { $set2 .= '.' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 3) 0 0 0
411 0 ▶ if ($diff == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 4) 0 0 0
412 0 ▶ if ($set2 =~ s/\x81\x40\x81\x40\x81\x40$/ \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\x81\x40\x81\x40\x81\x40$/ \201\@ \201\@ /) { } 0 0 0
413 0 else { $set2 =~ s/\x81\x40$/\.\.\.\.\./; }
414 }
415 0 ▶ if ($diff == 5) { $set2 .= ' ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 5) 0 0 0
416 0 ▶ if ($diff == 6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 6) 0 0 0
417 0 ▶ if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40$/ \x81\x40 \x81\x40 \x81\x40 \. /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40$/ \201\@ \201\@ \201\@ . /) { } 0 0 0
418 0 else { $set2 .= '..' }
419 }
420 0 ▶ if ($diff == 7) { $set2 =~ s/\x81\x40\x81\x40\x81\x40$/ \x81\x40 \x81\x40 \./ }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 7) 0 0 0
421 0 ▶ if ($diff == 8) { $set2 .= ' .' }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 8) 0 0 0
422 0 ▶ if ($diff == 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 9) 0 0 0
423 0 ▶ if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40$/ \x81\x40 \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/\x81\x40\x81\x40\x81\x40\x81\x40$/ \201\@ \201\@ \201\@ /) { } 0 0 0
424 0 else { $set2 .= '...' }
425 }
426 0 ▶ if ($diff == 10) { $set2 =~ s/\x81\x40\x81\x40$/\x81\x40 \x81\x40 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 10) 0 0 0
427
428 0 return "$str_l$set2$str_r";
429 }
430 # When you want to process it with Shift_JIS disregarding the character-code declaration and position 'L'.
431 # $aart -> adjust_left_sjis($str_l, $str_r, $size);
432 0 ▶sub adjust_left_sjis {
Subroutine adjust_left_sjis: not called CC=18 SCAR=58.3
Pod undocumented
433 0 my $self = shift;
434 0 ▶ my $str_l = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
435 0 ▶ my $str_r = shift || q{};
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
436 0 my $size = shift;
437
438 0 my $count = $self -> calcu_sjis("$str_l$str_r");
439 0 my $diff = $size - $count;
440 0 my $space = int( $diff/11 );
441
442 0 my $set2 = q{};
443 0 ▶ for (my $t = 0; $t < $space; $t ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t < $space) 0 0 0
444 0 $diff -= 11;
445 0 $set2 .= "\x81\x40";
446 }
447 0 ▶ if ($diff == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 1) 0 0 0
448 0 ▶ if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40/\. \x81\x40 \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40/. \201\@ \201\@ \201\@ /) { } 0 0 0
449 0 else { $set2 =~ s/^\x81\x40/\.\.\.\./; }
450 }
451 0 ▶ if ($diff == 2) { $set2 =~ s/^\x81\x40\x81\x40/\. \x81\x40 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 2) 0 0 0
452 0 ▶ if ($diff == 3) { $set2 = '.'.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 3) 0 0 0
453 0 ▶ if ($diff == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 4) 0 0 0
454 0 ▶ if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40/ \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40/ \201\@ \201\@ /) { } 0 0 0
455 0 else { $set2 =~ s/^\x81\x40/\.\.\.\.\./ }
456 }
457 0 ▶ if ($diff == 5) { $set2 = ' '.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 5) 0 0 0
458 0 ▶ if ($diff == 6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 6) 0 0 0
459 0 ▶ if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40/ \. \x81\x40 \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40\x81\x40/ . \201\@ \201\@ \201\@ /) { } 0 0 0
460 0 else { $set2 = '..'.$set2 }
461 }
462 0 ▶ if ($diff == 7) { $set2 =~ s/^\x81\x40\x81\x40\x81\x40/\. \x81\x40 \x81\x40 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 7) 0 0 0
463 0 ▶ if ($diff == 8) { $set2 = '. '.$set2 }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 8) 0 0 0
464 0 ▶ if ($diff == 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 9) 0 0 0
465 0 ▶ if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40/ \x81\x40 \x81\x40 \x81\x40 /) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($set2 =~ s/^\x81\x40\x81\x40\x81\x40\x81\x40/ \201\@ \201\@ \201\@ /) { } 0 0 0
466 0 else { $set2 = '...'.$set2 }
467 }
468 0 ▶ if ($diff == 10) { $set2 =~ s/^\x81\x40\x81\x40/\x81\x40 \x81\x40 / }
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 10) 0 0 0
469
470 0 return "$str_l$set2$str_r";
471 }
472 #-------------------------------------------------------------------------------
473 # The number of shorter dots where the character string of the array becomes complete is returned.
474 # $aart -> shorter(@array);
475 #-------------------------------------------------------------------------------
476 0 ▶sub shorter {
Subroutine shorter: not called CC=3 SCAR=24.8
Pod undocumented
477 0 my $self = shift;
478 0 my @array = @_;
479
480 0 ▶ return $self -> shorter_euc(@array) if $code eq 'euc';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" 0 0 0
481 0 ▶ return $self -> shorter_sjis(@array) if $code eq 'sjis';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" 0 0 0
482 }
483 # When you want to process it with EUC-JP disregarding the character-code declaration.
484 # $aart -> shorter_euc(@array);
485 0 ▶sub shorter_euc {
Subroutine shorter_euc: not called CC=6 SCAR=37.4
Pod undocumented
486 0 my $self = shift;
487 0 my @array = @_;
488 0 my $fit = 0;
489
490 0 foreach my $buf (@array) {
491 0 my $set = $self -> calcu_euc($buf);
492 0 ▶ next if $fit >= $set;
Branch: 1 branch
BranchTrueFalseTotal
if $fit >= $set 0 0 0
493 0 $fit = $set;
494 }
495
496 0 while (1) {
497 0 my $flag = 0;
498 0 foreach my $set (@array) {
499 0 my $temp = $self -> adjust_right_euc($set,q{},$fit);
500 0 my $temp2 = $self -> calcu_euc($temp);
501 0 ▶ next if $fit == $temp2;
Branch: 1 branch
BranchTrueFalseTotal
if $fit == $temp2 0 0 0
502 0 $flag = 1;
503 0 $fit ++;
504 0 last;
505 }
506 0 ▶ last unless $flag;
Branch: 1 branch
BranchTrueFalseTotal
unless $flag 0 0 0
507 }
508
509 0 return $fit;
510 }
511 # When you want to process it with Shift_JIS disregarding the character-code declaration.
512 # $aart -> shorter_sjis(@array);
513 0 ▶sub shorter_sjis {
Subroutine shorter_sjis: not called CC=6 SCAR=37.4
Pod undocumented
514 0 my $self = shift;
515 0 my @array = @_;
516 0 my $fit = 0;
517
518 0 foreach my $buf (@array) {
519 0 my $set = $self -> calcu_sjis($buf);
520 0 ▶ next if $fit >= $set;
Branch: 1 branch
BranchTrueFalseTotal
if $fit >= $set 0 0 0
521 0 $fit = $set;
522 }
523
524 0 while (1) {
525 0 my $flag = 0;
526 0 foreach my $set (@array) {
527 0 my $temp = $self -> adjust_right_sjis($set,q{},$fit);
528 0 my $temp2 = $self -> calcu_sjis($temp);
529 0 ▶ next if $fit == $temp2;
Branch: 1 branch
BranchTrueFalseTotal
if $fit == $temp2 0 0 0
530 0 $flag = 1;
531 0 $fit ++;
532 0 last;
533 }
534 0 ▶ last unless $flag;
Branch: 1 branch
BranchTrueFalseTotal
unless $flag 0 0 0
535 }
536
537 0 return $fit;
538 }
539 #-------------------------------------------------------------------------------
540 # The number of shorter dots that hits multiples of the number specified that
541 # the character string of the array becomes complete is returned.
542 # ($minimun, $magnification) = $aart -> shorter_multiple($width, \@arrayL, \@arrayR);
543 #-------------------------------------------------------------------------------
544 0 ▶sub shorter_multiple {
Subroutine shorter_multiple: not called CC=3 SCAR=24.8
Pod undocumented
545 0 my $self = shift;
546 0 my ($number, $left, $right) = @_;
547 0 my @arrayL = @$left;
548 0 my @arrayR = @$right;
549
550 0 ▶ return $self -> shorter_multiple_euc($number, \@$left, \@$right) if $code eq 'euc';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "euc" 0 0 0
551 0 ▶ return $self -> shorter_multiple_sjis($number, \@$left, \@$right) if $code eq 'sjis';
Branch: 1 branch
BranchTrueFalseTotal
if $code eq "sjis" 0 0 0
552 }
553 # When you want to process it with EUC-JP disregarding the character-code declaration.
554 # ($minimun, $magnification) = $aart -> shorter_multiple_euc($width, \@arrayL, \@arrayR);
555 0 ▶sub shorter_multiple_euc() {
Subroutine shorter_multiple_euc: not called CC=5 SCAR=34.0
Pod undocumented
556 0 my $self = shift;
557 0 my ($number, $left, $right) = @_;
558 0 my @arrayL = @$left;
559 0 my @arrayR = @$right;
560
561 0 my $width = $self -> shorter_euc(@arrayL) + $self -> shorter_euc(@arrayR);
562 0 my $multiple = $width / $number;
563 0 ▶ my $shorter = ( $multiple - int($multiple) ) ? $number * ( int($multiple) + 1) : $number * $multiple;
Branch: 1 branch
BranchTrueFalseTotal
$multiple - int($multiple) ? : 0 0 0
564
565 0 while (1) {
566 0 my $flag = 0;
567 0 ▶ for (my $i = 0; $i < @arrayL; $i ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @arrayL) 0 0 0
568 0 my $temp = $self -> adjust_right_euc($arrayL[$i], $arrayR[$i], $shorter);
569 0 my $temp2 = $self -> calcu_euc( $temp );
570 0 ▶ next if $shorter == $temp2;
Branch: 1 branch
BranchTrueFalseTotal
if $shorter == $temp2 0 0 0
571 0 $shorter += $number;
572 0 $flag = 1;
573 0 last;
574 }
575 0 ▶ last unless $flag;
Branch: 1 branch
BranchTrueFalseTotal
unless $flag 0 0 0
576 }
577
578 0 return $shorter, $shorter / $number;
579 }
580 # When you want to process it with Shift_JIS disregarding the character-code declaration.
581 # ($minimun, $magnification) = $aart -> shorter_multiple_sjis($width, \@arrayL, \@arrayR);
582 0 ▶sub shorter_multiple_sjis() {
Subroutine shorter_multiple_sjis: not called CC=5 SCAR=34.0
Pod undocumented
583 0 my $self = shift;
584 0 my ($number, $left, $right) = @_;
585 0 my @arrayL = @$left;
586 0 my @arrayR = @$right;
587
588 0 my $width = $self -> shorter_sjis(@arrayL) + $self -> shorter_sjis(@arrayR);
589 0 my $multiple = $width / $number;
590 0 ▶ my $shorter = ( $multiple - int($multiple) ) ? $number * ( int($multiple) + 1) : $number * $multiple;
Branch: 1 branch
BranchTrueFalseTotal
$multiple - int($multiple) ? : 0 0 0
591
592 0 while (1) {
593 0 my $flag = 0;
594 0 ▶ for (my $i = 0; $i < @arrayL; $i ++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @arrayL) 0 0 0
595 0 my $temp = $self -> adjust_right_sjis($arrayL[$i], $arrayR[$i], $shorter);
596 0 my $temp2 = $self -> calcu_sjis( $temp );
597 0 ▶ next if $shorter == $temp2;
Branch: 1 branch
BranchTrueFalseTotal
if $shorter == $temp2 0 0 0
598 0 $shorter += $number;
599 0 $flag = 1;
600 0 last;
601 }
602 0 ▶ last unless $flag;
Branch: 1 branch
BranchTrueFalseTotal
unless $flag 0 0 0
603 }
604
605 0 return $shorter, $shorter / $number;
606 }
607
608 1 1;
609 __END__
↑ Summary