blib/lib/Term/Sk.pm

filter: Statementstmt 92.0% 207 / 225 Branchbran 74.5% 82 / 110 Conditioncond 91.6% 22 / 24 MC/DCmcdc 80.0% 8 / 10 Subroutinesub 81.8% 18 / 22 Podpod 0.0% 0 / 17 totaltotal 82.6% 337 / 408 SCAR 43.4
CC
66
Cov
87%
new
23.1
show
19.9
show_maybe
11.2
CRAP 76.4
↑ Summary
1 package Term::Sk;
2 1 $Term::Sk::VERSION = '0.17';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Time::HiRes qw( time );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Fcntl qw(:seek);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 require Exporter;
10  
11 1 our @ISA = qw(Exporter);
12 1 our %EXPORT_TAGS = ( 'all' => [ qw(set_chunk_size set_bkup_size rem_backspace) ] );
13 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
14 1 our @EXPORT = qw();
15  
16 1 our $errcode = 0;
17 1 our $errmsg = '';
18  
19 sub new {
20 27 ▶ shift;
Subroutine new: called CC=23 SCAR=31.4
Pod undocumented
21 27 my $self = {};
22 27 bless $self;
23  
24 27 $errcode = 0;
25 27 $errmsg = '';
26  
27 27 my %hash = (freq => 1, base => 0, target => 1_000, quiet => 0, test => 0, num => q{9_999});
28 27 ▶ %hash = (%hash, %{$_[1]}) if defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] 27 0 27
29  
30 27 ▶ my $format = defined $_[0] ? $_[0] : '%8c';
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 27 0 27
31  
32 27 $self->{base} = $hash{base};
33 27 $self->{target} = $hash{target};
34 27 $self->{quiet} = $hash{quiet};
35 27 $self->{test} = $hash{test};
36 27 $self->{format} = $format;
37 27 $self->{freq} = $hash{freq};
38 27 $self->{value} = $hash{base};
39 27 $self->{mock_tm} = $hash{mock_tm};
40 27 $self->{oldtext} = '';
41 27 $self->{line} = '';
42 27 $self->{pdisp} = '#';
43 27 $self->{commify} = $hash{commify};
44 27 ▶ $self->{token} = defined($hash{token}) ? ref($hash{token}) eq 'ARRAY' ? $hash{token} : [$hash{token}] : [];
Branch: 2 branches
BranchTrueFalseTotal
defined $hash{'token'} ? : 2 25 27
ref $hash{'token'} eq 'ARRAY' ? : 1 1 2
45  
46 27 ▶ unless (defined $self->{quiet}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"quiet"}) 0 27 27
47 0 $self->{quiet} = !-t STDOUT;
48 }
49  
50 27 ▶ if ($hash{num} eq '9') {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash{'num'} eq '9') { } 1 26 27
51 1 $self->{sep} = '';
52 1 $self->{group} = 0;
53 }
54 else {
55 26 ▶ my ($sep, $group) = $hash{num} =~ m{\A 9 ([^\d\+\-]) (9+) \z}xms or do {
Branch: 1 branch
BranchTrueFalseTotal
() = $hash{"num"} =~ /\A 9 ([^\d\+\-]) (9+) \z/msx or do { $Term::Sk::errcode = 95; $Term::Sk::errmsg = qq[Can't parse num => '$hash{"num"}']; die sprintf("Error-%04d: %s", $Term::Sk::errcode, $Term::Sk::errmsg) } 1 25 26
56 1 $errcode = 95;
57 1 $errmsg = qq{Can't parse num => '$hash{num}'};
58 1 die sprintf('Error-%04d: %s', $errcode, $errmsg);
59 };
60 25 $self->{sep} = $sep;
61 25 $self->{group} = length($group);
62 }
63  
64 # Here we de-compose the format into $self->{action}
65  
66 26 $self->{action} = [];
67  
68 26 my $fmt = $format;
69 26 ▶ while ($fmt ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fmt ne "") 48 24 72
70 48 ▶ if ($fmt =~ m{^ ([^%]*) % (.*) $}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fmt =~ /^ ([^%]*) % (.*) $/msx) { } 44 4 48
71 44 my ($literal, $portion) = ($1, $2);
72 44 ▶ unless ($portion =~ m{^ (\d*) ([a-zA-Z]) (.*) $}xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($portion =~ /^ (\d*) ([a-zA-Z]) (.*) $/msx) 1 43 44
73 1 $errcode = 100;
74 1 $errmsg = qq{Can't parse '%[<number>]<alpha>' from '%$portion', total line is '$format'};
75 1 die sprintf('Error-%04d: %s', $errcode, $errmsg);
76 }
77  
78 43 my ($repeat, $disp_code, $remainder) = ($1, $2, $3);
79  
80 43 ▶ if ($repeat eq '') { $repeat = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($repeat eq "") 23 20 43
81 43 ▶ if ($repeat < 1) { $repeat = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($repeat < 1) 0 43 43
82  
83 43 ▶ unless ($disp_code eq 'b'
Branch: 1 branch
BranchTrueFalseTotal
unless ($disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p" or $disp_code eq "P" or $disp_code eq "t" or $disp_code eq "k") 1 42 43
Condition100%21/21
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p" or $disp_code eq "P" or $disp_code eq "t" or $disp_code eq "k"
l!l&&r!l&&!r
3931
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p" or $disp_code eq "P" or $disp_code eq "t"
l!l&&r!l&&!r
3454
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p" or $disp_code eq "P"
l!l&&r!l&&!r
3229
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p"
l!l&&r!l&&!r
30211
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m"
l!l&&r!l&&!r
201013
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d"
l!l&&r!l&&!r
16423
$disp_code eq "b" or $disp_code eq "c"
l!l&&r!l&&!r
21427
MC/DC100%8/8
$disp_code eq "b" or $disp_code eq "c" or $disp_code eq "d" or $disp_code eq "m" or $disp_code eq "p" or $disp_code eq "P" or $disp_code eq "t" or $disp_code eq "k"
$disp_code eq "b" $disp_code eq "c" $disp_code eq "d" $disp_code eq "m" $disp_code eq "p" $disp_code eq "P" $disp_code eq "t" $disp_code eq "k"
Truth table100%9/9
A or B or C or D or E or F or G or H
A= $disp_code eq "b"B= $disp_code eq "c"C= $disp_code eq "d"D= $disp_code eq "m"E= $disp_code eq "p"F= $disp_code eq "P"G= $disp_code eq "t"H= $disp_code eq "k"
ABCDEFGHresult
1XXXXXXX1
01XXXXXX1
001XXXXX1
0001XXXX1
00001XXX1
000001XX1
0000001X1
000000011
000000000
84 or $disp_code eq 'c'
85 or $disp_code eq 'd'
86 or $disp_code eq 'm'
87 or $disp_code eq 'p'
88 or $disp_code eq 'P'
89 or $disp_code eq 't'
90 or $disp_code eq 'k') {
91 1 $errcode = 110;
92 1 $errmsg = qq{Found invalid display-code ('$disp_code'), expected ('b', 'c', 'd', 'm', 'p', 'P' 't' or 'k') in '%$portion', total line is '$format'};
93 1 die sprintf('Error-%04d: %s', $errcode, $errmsg);
94 }
95  
96 42 ▶ push @{$self->{action}}, {type => '*lit', len => length($literal), lit => $literal} if length($literal) > 0;
Branch: 1 branch
BranchTrueFalseTotal
if length $literal > 0 40 2 42
97 42 push @{$self->{action}}, {type => $disp_code, len => $repeat};
98 42 $fmt = $remainder;
99 }
100 else {
101 4 push @{$self->{action}}, {type => '*lit', len => length($fmt), lit => $fmt};
102 4 $fmt = '';
103 }
104 }
105  
106 # End of format de-composition
107  
108 24 $self->{tick} = 0;
109 24 $self->{out} = 0;
110 24 ▶ $self->{sec_begin} = $self->{mock_tm} ? $self->{mock_tm} : time;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'mock_tm'} ? : 3 21 24
111 24 $self->{sec_print} = 0;
112  
113 24 $self->show;
114  
115 24 return $self;
116 }
117  
118 sub mock_time {
119 5 ▶ my $self = shift;
Subroutine mock_time: called CC=1 SCAR=0.0
Pod undocumented
120  
121 5 $self->{mock_tm} = $_[0];
122 }
123  
124 sub whisper {
125 1 ▶ my $self = shift;
Subroutine whisper: called CC=3 SCAR=14.8
Pod undocumented
126
127 1 my $back = qq{\010} x length $self->{oldtext};
128 1 my $blank = q{ } x length $self->{oldtext};
129  
130 1 $self->{line} = join('', $back, $blank, $back, @_, $self->{oldtext});
131  
132 1 ▶ unless ($self->{test}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"test"}) 0 1 1
133 0 local $| = 1;
134 0 ▶ if ($self->{quiet}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'quiet'}) { } 0 0 0
135 0 print @_;
136 }
137 else {
138 0 print $self->{line};
139 }
140 }
141 }
142  
143 sub get_line {
144 35 ▶ my $self = shift;
Subroutine get_line: called CC=1 SCAR=0.0
Pod undocumented
145  
146 35 return $self->{line};
147 }
148  
149 61 ▶sub up { my $self = shift; $self->{value} += defined $_[0] ? $_[0] : 1; $self->show_maybe; }
Subroutine up: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 2 59 61
150 0 ▶sub down { my $self = shift; $self->{value} -= defined $_[0] ? $_[0] : 1; $self->show_maybe; }
Subroutine down: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 0 0 0
151 28 ▶sub close { my $self = shift; $self->{value} = undef; $self->show; }
Subroutine close: called CC=1 SCAR=0.0
Pod undocumented
152  
153 1 ▶sub ticks { my $self = shift; return $self->{tick} }
Subroutine ticks: called CC=1 SCAR=0.0
Pod undocumented
154  
155 sub token {
156 2 ▶ my $self = shift;
Subroutine token: called CC=2 SCAR=6.9
Pod undocumented
157 2 my $tk = shift;
158 2 ▶ $self->{token} = ref($tk) eq 'ARRAY' ? $tk : [$tk];
Branch: 1 branch
BranchTrueFalseTotal
ref $tk eq 'ARRAY' ? : 1 1 2
159 2 $self->show;
160 }
161  
162 sub tok_maybe {
163 1 ▶ my $self = shift;
Subroutine tok_maybe: called CC=2 SCAR=7.0
Pod undocumented
164 1 my $tk = shift;
165 1 ▶ $self->{token} = ref($tk) eq 'ARRAY' ? $tk : [$tk];
Branch: 1 branch
BranchTrueFalseTotal
ref $tk eq 'ARRAY' ? : 0 1 1
166 1 $self->show_maybe;
167 }
168  
169 sub DESTROY {
170 27 ▶ my $self = shift;
Subroutine DESTROY: called CC=1 SCAR=0.0
171 27 $self->close;
172 }
173  
174 sub show_maybe {
175 62 ▶ my $self = shift;
Subroutine show_maybe: called CC=7 SCAR=24.1
Pod undocumented
176  
177 62 $self->{line} = '';
178  
179 62 ▶ my $sec_now = ($self->{mock_tm} ? $self->{mock_tm} : time) - $self->{sec_begin};
Branch: 1 branch
BranchTrueFalseTotal
$self->{'mock_tm'} ? : 5 57 62
180 62 my $sec_prev = $self->{sec_print};
181  
182 62 $self->{sec_print} = $sec_now;
183 62 $self->{tick}++;
184  
185 62 ▶ if ($self->{freq} eq 's') {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'freq'} eq 's') { } 0 62 62
elsif ($self->{'freq'} eq 'd') { } 0 62 62
186 0 ▶ if (int($sec_prev) != int($sec_now)) {
Branch: 1 branch
BranchTrueFalseTotal
if (int $sec_prev != int $sec_now) 0 0 0
187 0 $self->show;
188 }
189 }
190 elsif ($self->{freq} eq 'd') {
191 0 ▶ if (int($sec_prev * 10) != int($sec_now * 10)) {
Branch: 1 branch
BranchTrueFalseTotal
if (int $sec_prev * 10 != int $sec_now * 10) 0 0 0
192 0 $self->show;
193 }
194 }
195 else {
196 62 ▶ unless ($self->{tick} % $self->{freq}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"tick"} % $self->{"freq"}) 62 0 62
197 62 $self->show;
198 }
199 }
200 }
201  
202 sub show {
203 116 ▶ my $self = shift;
Subroutine show: called CC=19 SCAR=29.9
Pod undocumented
204 116 $self->{out}++;
205  
206 116 my $back = qq{\010} x length $self->{oldtext};
207 116 my $blank = q{ } x length $self->{oldtext};
208  
209 116 my $text = '';
210 116 ▶ if (defined $self->{value}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"value"}) 88 28 116
211  
212 # Here we compose a string based on $self->{action} (which, of course, is the previously de-composed format)
213  
214 88 my $tok_ind = 0;
215  
216 88 for my $act (@{$self->{action}}) {
217 214 my ($type, $lit, $len) = ($act->{type}, $act->{lit}, $act->{len});
218  
219 214 ▶ if ($type eq '*lit') { # print (= append to $text) a simple literal
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "*lit") 122 92 214
220 122 $text .= $lit;
221 122 next;
222 }
223 92 ▶ if ($type eq 't') { # print (= append to $text) time elapsed in format 'hh:mm:ss'
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "t") 10 82 92
224 10 my $unit = int($self->{sec_print});
225 10 my $hour = int($unit / 3600);
226 10 my $min = int(($unit % 3600) / 60);
227 10 my $sec = $unit % 60;
228 10 my $stamp = sprintf '%02d:%02d:%02d', $hour, $min, $sec;
229  
230 10 ▶ $stamp = substr($stamp, -$len) if length($stamp) > $len;
Branch: 1 branch
BranchTrueFalseTotal
if length $stamp > $len 2 8 10
231  
232 10 $text .= sprintf "%${len}.${len}s", $stamp;
233 10 next;
234 }
235 82 ▶ if ($type eq 'd') { # print (= append to $text) a revolving dash in format '/-\|'
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "d") 10 72 82
236 10 $text .= substr('/-\|', $self->{out} % 4, 1) x $len;
237 10 next;
238 }
239 72 ▶ if ($type eq 'b') { # print (= append to $text) progress indicator format '#####_____'
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "b") 13 59 72
240 my $progress = $self->{target} == $self->{base} ? 0 :
241 13 ▶ int ($len * ($self->{value} - $self->{base}) / ($self->{target} - $self->{base}) + 0.5);
Branch: 1 branch
BranchTrueFalseTotal
$self->{'target'} == $self->{'base'} ? : 0 13 13
242 13 ▶ if ($progress < 0) { $progress = 0 }
Branch: 2 branches
BranchTrueFalseTotal
if ($progress < 0) { } 0 13 13
elsif ($progress > $len) { } 0 13 13
243 0 elsif ($progress > $len) { $progress = $len }
244 13 $text .= $self->{pdisp} x $progress.'_' x ($len - $progress);
245 13 next;
246 }
247 59 ▶ if ($type eq 'p') { # print (= append to $text) progress in percentage format '999%'
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "p") 7 52 59
248 my $percent = $self->{target} == $self->{base} ? 0 :
249 7 ▶ 100 * ($self->{value} - $self->{base}) / ($self->{target} - $self->{base});
Branch: 1 branch
BranchTrueFalseTotal
$self->{'target'} == $self->{'base'} ? : 0 7 7
250 7 $text .= sprintf "%${len}.${len}s", sprintf("%.0f%%", $percent);
251 7 next;
252 }
253 52 ▶ if ($type eq 'P') { # print (= append to $text) literally '%' characters
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "P") 2 50 52
254 2 $text .= '%' x $len;
255 2 next;
256 }
257 50 ▶ if ($type eq 'c') { # print (= append to $text) actual counter value (commified)
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "c") 31 19 50
258 31 $text .= sprintf "%${len}s", commify($self->{commify}, $self->{value}, $self->{sep}, $self->{group});
259 31 next;
260 }
261 19 ▶ if ($type eq 'm') { # print (= append to $text) target (commified)
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "m") 12 7 19
262 12 $text .= sprintf "%${len}s", commify($self->{commify}, $self->{target}, $self->{sep}, $self->{group});
263 12 next;
264 }
265 7 ▶ if ($type eq 'k') { # print (= append to $text) token
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "k") 7 0 7
266 7 $text .= sprintf "%-${len}s", $self->{token}[$tok_ind];
267 7 $tok_ind++;
268 7 next;
269 }
270 # default: do nothing, in the (impossible) event that $type is none of '*lit', 't', 'b', 'p', 'P', 'c', 'm' or 'k'
271 }
272  
273 # End of string composition
274 }
275  
276 116 $self->{line} = join('', $back, $blank, $back, $text);
277  
278 116 ▶ unless ($self->{test} or $self->{quiet}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"test"} or $self->{"quiet"}) 0 116 116
Condition33%1/3
$self->{"test"} or $self->{"quiet"}
l!l&&r!l&&!r
11600
MC/DC0%0/2
$self->{"test"} or $self->{"quiet"}
$self->{"test"} $self->{"quiet"}
Truth table33%1/3
A or B
A= $self->{"test"}B= $self->{"quiet"}
ABresult
1X1
011
000
279 0 local $| = 1;
280 0 print $self->{line};
281 }
282  
283 116 $self->{oldtext} = $text;
284 }
285  
286 sub commify {
287 43 ▶ my $com = shift;
Subroutine commify: called CC=5 SCAR=16.1
Pod undocumented
288 43 ▶ if ($com) { return $com->($_[0]); }
Branch: 1 branch
BranchTrueFalseTotal
if ($com) 2 41 43
289  
290 41 local $_ = shift;
291 41 my ($sep, $group) = @_;
292  
293 41 ▶ if ($group > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($group > 0) 39 2 41
294 39 my $len = length($_);
295 39 for my $i (1..$len) {
296 76 ▶ last unless s/^([-+]?\d+)(\d{$group})/$1$sep$2/;
Branch: 1 branch
BranchTrueFalseTotal
unless s/^([-+]?\d+)(\d{$group})/$1$sep$2/ 39 37 76
297 }
298 }
299 41 return $_;
300 }
301  
302 1 my $chunk_size = 10000;
303 1 my $bkup_size = 80;
304  
305 # Decision by Klaus Eichner, 31-MAY-2011:
306 # ---------------------------------------
307 # Make subs log_info(), set_chunk_size() and set_bkup_size() effectively dummy operations (i.e. they
308 # don't have any effect whatsoever)
309  
310 ▶sub log_info { }
Subroutine log_info: not called CC=1 SCAR=0.0
Pod undocumented
311 ▶sub set_chunk_size { }
Subroutine set_chunk_size: not called CC=1 SCAR=0.0
Pod undocumented
312 ▶sub set_bkup_size { }
Subroutine set_bkup_size: not called CC=1 SCAR=0.0
Pod undocumented
313  
314 sub rem_backspace {
315 3 ▶ my ($fname) = @_;
Subroutine rem_backspace: called CC=10 SCAR=23.3
Pod undocumented
316  
317 3 ▶ open my $ifh, '<', $fname or die "Error-0200: Can't open < '$fname' because $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $ifh, "<", $fname or die "Error-0200: Can't open < '${fname}' because $!" 0 3 3
318 3 ▶ open my $tfh, '+>', undef or die "Error-0210: Can't open +> undef (tempfile) because $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $tfh, "+>", undef or die "Error-0210: Can't open +> undef (tempfile) because $!" 0 3 3
319  
320 3 my $out_buf = '';
321  
322 3 ▶ while (read($ifh, my $inp_buf, $chunk_size)) {
Branch: 1 branch
BranchTrueFalseTotal
if (read $ifh, my $inp_buf, $chunk_size) 3 3 6
323 3 $out_buf .= $inp_buf;
324  
325 # here we are removing the backspaces:
326 3 ▶ while ($out_buf =~ m{\010+}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($out_buf =~ /\010+/msx) 4 3 7
327 4 my $pos_left = $-[0] * 2 - $+[0];
328 4 ▶ if ($pos_left < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos_left < 0) 0 4 4
329 0 $pos_left = 0;
330 }
331 4 $out_buf = substr($out_buf, 0, $pos_left).substr($out_buf, $+[0]);
332 }
333  
334 3 ▶ if (length($out_buf) > $bkup_size) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $out_buf > $bkup_size) 1 2 3
335 1 print {$tfh} substr($out_buf, 0, -$bkup_size);
336 1 $out_buf = substr($out_buf, -$bkup_size);
337 }
338 }
339  
340 3 CORE::close $ifh; # We need to employ CORE::close because there is already another close subroutine defined in the current namespace "Term::Sk"
341  
342 3 print {$tfh} $out_buf;
343  
344 # Now copy back temp-file to original file:
345  
346 3 ▶ seek $tfh, 0, SEEK_SET or die "Error-0220: Can't seek tempfile to 0 because $!";
Branch: 1 branch
BranchTrueFalseTotal
seek $tfh, 0, 0 or die "Error-0220: Can't seek tempfile to 0 because $!" 0 3 3
347 3 ▶ open my $ofh, '>', $fname or die "Error-0230: Can't open > '$fname' because $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $ofh, ">", $fname or die "Error-0230: Can't open > '${fname}' because $!" 0 3 3
348  
349 3 ▶ while (read($tfh, my $buf, $chunk_size)) { print {$ofh} $buf; }
Branch: 1 branch
BranchTrueFalseTotal
if (read $tfh, my $buf, $chunk_size) 3 3 6
350  
351 3 CORE::close $ofh;
352 3 CORE::close $tfh;
353 }
354  
355 1 1;
356  
357 __END__
↑ Summary