| 1 | ############################################################################### | ||||||||||||||||||||||||||||
| 2 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 3 | ## File path and Scalar reference input reader. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This package provides the read handle method used internally by the worker | ||||||||||||||||||||||||||||
| 6 | ## process. Distribution follows a bank-queuing model. | ||||||||||||||||||||||||||||
| 7 | ## | ||||||||||||||||||||||||||||
| 8 | ## There is no public API. | ||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||
| 10 | ############################################################################### | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | package MCE::Core::Input::Handle; | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 13 | our $VERSION = '1.904'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | ## Items below are folded into MCE. | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | package # hide from rpm | ||||||||||||||||||||||||||||
| 22 | MCE; | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 13 | ▶ | no warnings qw( threads recursion uninitialized ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 13 | my $_que_read_size = $MCE::_que_read_size; | |||||||||||||||||||||||||||
| 27 | 13 | my $_que_template = $MCE::_que_template; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | ############################################################################### | ||||||||||||||||||||||||||||
| 30 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 31 | ## Worker process -- Read handle. | ||||||||||||||||||||||||||||
| 32 | ## | ||||||||||||||||||||||||||||
| 33 | ############################################################################### | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub _systell { | ||||||||||||||||||||||||||
|
Subroutine
_systell: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 36 | # To minimize memory consumption, SEEK_CUR equals 1 on most platforms. | ||||||||||||||||||||||||||||
| 37 | # e.g. use Fcntl qw(SEEK_CUR); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | sysseek($_[0], 0, 1); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 14 | ▶ | sub _worker_read_handle { | ||||||||||||||||||||||||||
|
Subroutine
_worker_read_handle: called CC=44 SCAR=57.5
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 14 | my ($self, $_proc_type, $_input_data) = @_; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 14 | @_ = (); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | _croak('MCE::_worker_read_handle: (user_func) is not specified') | ||||||||||||||||||||||||||||
| 49 | 14 | ▶ | unless (defined $self->{user_func}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 14 | ▶ | my $_is_MSWin32 = ($^O eq 'MSWin32') ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 14 | my $_QUE_R_SOCK = $self->{_que_r_sock}; | |||||||||||||||||||||||||||
| 53 | 14 | my $_QUE_W_SOCK = $self->{_que_w_sock}; | |||||||||||||||||||||||||||
| 54 | 14 | my $_chunk_size = $self->{chunk_size}; | |||||||||||||||||||||||||||
| 55 | 14 | my $_use_slurpio = $self->{use_slurpio}; | |||||||||||||||||||||||||||
| 56 | 14 | my $_parallel_io = $self->{parallel_io}; | |||||||||||||||||||||||||||
| 57 | 14 | ▶ | my $_RS = $self->{RS} || $/; | ||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'RS'} || $/
MC/DC0%0/2
$self->{'RS'} || $/
$self->{'RS'}
$/
Truth table33%1/3
A || B
A= $self->{'RS'}B= $/
| |||||||||||||||||||||||||||||
| 58 | 14 | my $_wuf = $self->{_wuf}; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 14 | my ($_data_size, $_next, $_chunk_id, $_offset_pos, $_IN_FILE, $_tmp_cs); | |||||||||||||||||||||||||||
| 61 | 14 | my ($_DAT_LOCK, $_dat_ex, $_dat_un, $_pid, $_chop_len, $_chop_str, $_p); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 14 | ▶ | $_pid = $INC{'threads.pm'} ? $$ .'.'. threads->tid() : $$; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # inlined for performance | ||||||||||||||||||||||||||||
| 66 | 14 | $_DAT_LOCK = $self->{'_mutex_'.( $self->{_wid} % 2 + 10 )}; | |||||||||||||||||||||||||||
| 67 | 65 | ▶ | $_dat_ex = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||
| 68 | CORE::lock($_DAT_LOCK->{_t_lock}), MCE::Util::_sock_ready($_DAT_LOCK->{_r_sock}) | ||||||||||||||||||||||||||||
| 69 | 65 | ▶ | if $_is_MSWin32; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | MCE::Util::_sysread($_DAT_LOCK->{_r_sock}, my($b), 1), $_DAT_LOCK->{ $_pid } = 1 | ||||||||||||||||||||||||||||
| 71 | 65 | ▶ | unless $_DAT_LOCK->{ $_pid }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 14 | }; | |||||||||||||||||||||||||||
| 73 | 65 | ▶ | $_dat_un = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 74 | syswrite($_DAT_LOCK->{_w_sock}, '0'), $_DAT_LOCK->{ $_pid } = 0 | ||||||||||||||||||||||||||||
| 75 | 65 | ▶ | if $_DAT_LOCK->{ $_pid }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 14 | }; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 14 | ▶ | if (length $_RS > 1 && substr($_RS, 0, 1) eq "\n") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $_RS > 1 and substr($_RS, 0, 1) eq "\n"
MC/DC0%0/2
length $_RS > 1 and substr($_RS, 0, 1) eq "\n"
length $_RS > 1
substr($_RS, 0, 1) eq "\n"
Truth table33%1/3
A and B
A= length $_RS > 1B= substr($_RS, 0, 1) eq "\n"
| |||||||||||||||||||||||||||||
| 79 | 0 | $_chop_str = substr($_RS, 1); | |||||||||||||||||||||||||||
| 80 | 0 | $_chop_len = length $_chop_str; | |||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||
| 82 | 14 | $_chop_str = ''; | |||||||||||||||||||||||||||
| 83 | 14 | $_chop_len = 0; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | $_data_size = ($_proc_type == READ_MEMORY) | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | ? length ${ $_input_data } : -s $_input_data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 14 | $_chunk_id = $_offset_pos = 0; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 14 | ▶ | open $_IN_FILE, '<', $_input_data or die "$_input_data: $!\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 14 | binmode $_IN_FILE; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $self->{_next_jmp} = sub { goto _WORKER_READ_HANDLE__NEXT; }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $self->{_last_jmp} = sub { goto _WORKER_READ_HANDLE__LAST; }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 14 | local $_; | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | _WORKER_READ_HANDLE__NEXT: | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 14 | while (1) { | |||||||||||||||||||||||||||
| 104 | 65 | ▶ | my @_recs; undef $_ if (length > MAX_GC_SIZE); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 65 | $_ = ''; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | ## Obtain the next chunk_id and offset position. | ||||||||||||||||||||||||||||
| 109 | 65 | $_dat_ex->(); | |||||||||||||||||||||||||||
| 110 | 65 | ▶ | MCE::Util::_sock_ready($_QUE_R_SOCK) if $_is_MSWin32; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 65 | MCE::Util::_sysread($_QUE_R_SOCK, $_next, $_que_read_size); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 65 | ($_chunk_id, $_offset_pos) = unpack($_que_template, $_next); | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 65 | ▶ | if ($_offset_pos >= $_data_size) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 14 | syswrite($_QUE_W_SOCK, pack($_que_template, 0, $_offset_pos)); | |||||||||||||||||||||||||||
| 117 | 14 | $_dat_un->(); | |||||||||||||||||||||||||||
| 118 | 14 | close $_IN_FILE; undef $_IN_FILE; | |||||||||||||||||||||||||||
| 119 | 14 | return; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 51 | ▶ | if (++$_chunk_id > 1 && $_chop_len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
++$_chunk_id > 1 and $_chop_len
MC/DC0%0/2
++$_chunk_id > 1 and $_chop_len
++$_chunk_id > 1
$_chop_len
Truth table66%2/3
A and B
A= ++$_chunk_id > 1B= $_chop_len
| |||||||||||||||||||||||||||||
| 123 | 0 | $_p = $_chop_len; $_ = $_chop_str; | |||||||||||||||||||||||||||
| 124 | } else { | ||||||||||||||||||||||||||||
| 125 | 51 | $_p = 0; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | ## Read data. | ||||||||||||||||||||||||||||
| 129 | 51 | ▶ | if ($_chunk_size <= MAX_RECS_SIZE) { # One or many records. | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 51 | ▶ | local $/ = $_RS if ($/ ne $_RS); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 51 | seek $_IN_FILE, $_offset_pos, 0; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 51 | ▶ | if ($_chunk_size == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 36 | ▶ | if ($_p) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 0 | $_ .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 136 | } else { | ||||||||||||||||||||||||||||
| 137 | 36 | $_ = <$_IN_FILE>; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | else { | ||||||||||||||||||||||||||||
| 141 | 15 | ▶ | if ($_use_slurpio) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 0 | for my $i (0 .. $_chunk_size - 1) { | |||||||||||||||||||||||||||
| 143 | 0 | $_ .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | else { | ||||||||||||||||||||||||||||
| 147 | 15 | ▶ | if ($_chop_len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $_recs[0] = ($_chunk_id > 1) ? $_chop_str : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | $_recs[0] .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 150 | 0 | for my $i (1 .. $_chunk_size - 1) { | |||||||||||||||||||||||||||
| 151 | 0 | $_recs[$i] = $_chop_str; | |||||||||||||||||||||||||||
| 152 | 0 | $_recs[$i] .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (length $_recs[$i] == $_chop_len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 0 | delete $_recs[$i]; | |||||||||||||||||||||||||||
| 155 | 0 | last; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | else { | ||||||||||||||||||||||||||||
| 160 | 15 | for my $i (0 .. $_chunk_size - 1) { | |||||||||||||||||||||||||||
| 161 | 30 | $_recs[$i] = <$_IN_FILE>; | |||||||||||||||||||||||||||
| 162 | 30 | ▶ | unless (defined $_recs[$i]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 3 | delete $_recs[$i]; | |||||||||||||||||||||||||||
| 164 | 3 | last; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 51 | syswrite( | |||||||||||||||||||||||||||
| 172 | $_QUE_W_SOCK, pack($_que_template, $_chunk_id, tell $_IN_FILE) | ||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||
| 174 | 51 | $_dat_un->(); | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | else { # Large chunk. | ||||||||||||||||||||||||||||
| 177 | 0 | ▶ | local $/ = $_RS if ($/ ne $_RS); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($_parallel_io && $_RS eq $LF) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_parallel_io and $_RS eq $MCE::LF
MC/DC0%0/2
$_parallel_io and $_RS eq $MCE::LF
$_parallel_io
$_RS eq $MCE::LF
Truth table0%0/3
A and B
A= $_parallel_ioB= $_RS eq $MCE::LF
| |||||||||||||||||||||||||||||
| 180 | 0 | syswrite( | |||||||||||||||||||||||||||
| 181 | $_QUE_W_SOCK, | ||||||||||||||||||||||||||||
| 182 | pack($_que_template, $_chunk_id, $_offset_pos + $_chunk_size) | ||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||
| 184 | 0 | $_dat_un->(); | |||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | $_tmp_cs = $_chunk_size; | |||||||||||||||||||||||||||
| 187 | 0 | seek $_IN_FILE, $_offset_pos, 0; | |||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ($_offset_pos) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $_tmp_cs -= length <$_IN_FILE> || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
length readline $_IN_FILE || 0
MC/DC0%0/1
length readline $_IN_FILE || 0
length readline $_IN_FILE
Truth table0%0/2
A
A= length readline $_IN_FILE
| |||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($_proc_type == READ_FILE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 0 | sysseek($_IN_FILE, tell( $_IN_FILE ), 0); | |||||||||||||||||||||||||||
| 195 | 0 | sysread($_IN_FILE, $_, $_tmp_cs, $_p); | |||||||||||||||||||||||||||
| 196 | 0 | seek $_IN_FILE, _systell($_IN_FILE), 0; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||
| 199 | 0 | read $_IN_FILE, $_, $_tmp_cs, $_p; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | $_ .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | else { | ||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if ($_proc_type == READ_FILE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | sysseek($_IN_FILE, $_offset_pos, 0); | |||||||||||||||||||||||||||
| 207 | 0 | sysread($_IN_FILE, $_, $_chunk_size, $_p); | |||||||||||||||||||||||||||
| 208 | 0 | seek $_IN_FILE, _systell($_IN_FILE), 0; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | else { | ||||||||||||||||||||||||||||
| 211 | 0 | seek $_IN_FILE, $_offset_pos, 0; | |||||||||||||||||||||||||||
| 212 | 0 | read $_IN_FILE, $_, $_chunk_size, $_p; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | $_ .= <$_IN_FILE>; | |||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | syswrite( | |||||||||||||||||||||||||||
| 218 | $_QUE_W_SOCK, pack($_que_template, $_chunk_id, tell $_IN_FILE) | ||||||||||||||||||||||||||||
| 219 | ); | ||||||||||||||||||||||||||||
| 220 | 0 | $_dat_un->(); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | ## Call user function. | ||||||||||||||||||||||||||||
| 225 | 51 | ▶ | if ($_use_slurpio) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if ($_chop_len && substr($_, -$_chop_len) eq $_chop_str) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_chop_len and substr($_, -$_chop_len) eq $_chop_str
MC/DC0%0/2
$_chop_len and substr($_, -$_chop_len) eq $_chop_str
$_chop_len
substr($_, -$_chop_len) eq $_chop_str
Truth table0%0/3
A and B
A= $_chop_lenB= substr($_, -$_chop_len) eq $_chop_str
| |||||||||||||||||||||||||||||
| 227 | 0 | substr($_, -$_chop_len, $_chop_len, ''); | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | 0 | local $_ = \$_; | |||||||||||||||||||||||||||
| 230 | 0 | $_wuf->($self, $_, $_chunk_id); | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||
| 233 | 51 | ▶ | if ($_chunk_size == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 36 | ▶ | if ($_chop_len && substr($_, -$_chop_len) eq $_chop_str) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_chop_len and substr($_, -$_chop_len) eq $_chop_str
MC/DC0%0/2
$_chop_len and substr($_, -$_chop_len) eq $_chop_str
$_chop_len
substr($_, -$_chop_len) eq $_chop_str
Truth table33%1/3
A and B
A= $_chop_lenB= substr($_, -$_chop_len) eq $_chop_str
| |||||||||||||||||||||||||||||
| 235 | 0 | substr($_, -$_chop_len, $_chop_len, ''); | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | 36 | $_wuf->($self, [ $_ ], $_chunk_id); | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | else { | ||||||||||||||||||||||||||||
| 240 | 15 | ▶ | if ($_chunk_size > MAX_RECS_SIZE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | local $/ = $_RS if ($/ ne $_RS); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 0 | _sync_buffer_to_array(\$_, \@_recs, $_chop_str); | |||||||||||||||||||||||||||
| 243 | 0 | undef $_; | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 15 | ▶ | if ($_chop_len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 0 | for my $i (0 .. @_recs - 1) { | |||||||||||||||||||||||||||
| 247 | 0 | ▶ | if (substr($_recs[$i], -$_chop_len) eq $_chop_str) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 0 | substr($_recs[$i], -$_chop_len, $_chop_len, ''); | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | 15 | local $_ = \@_recs; | |||||||||||||||||||||||||||
| 253 | 15 | $_wuf->($self, \@_recs, $_chunk_id); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | _WORKER_READ_HANDLE__LAST: | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | close $_IN_FILE; undef $_IN_FILE; | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | return; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 13 | 1; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | __END__ | ||||||||||||||||||||||||||||