line |
true |
false |
branch |
28
|
0 |
278 |
unless defined($args{'dir'} = delete $args0{'dir'}) |
30
|
0 |
278 |
unless defined($args{'prefix'} = delete $args0{'prefix'}) |
36
|
39 |
239 |
if ($args{'period'}) |
37
|
0 |
39 |
unless $args{'period'} =~ /\A(daily|day|month|monthly|year|yearly)\z/ |
43
|
1373 |
17 |
unless $args0{$_} |
46
|
0 |
17 |
unless ref $args{$_} eq 'CODE' |
49
|
21 |
218 |
unless ($args{'period'} or $args{'size'}) |
60
|
0 |
278 |
unless $args{'lock_mode'} =~ /\A(none|write|exclusive)\z/ |
64
|
0 |
278 |
if (defined $args{'rotate_probability'}) |
65
|
0 |
0 |
unless $args{'rotate_probability'} > 0 and $args{'rotate_probability'} < 1 |
69
|
0 |
278 |
if (keys %args0) |
78
|
1 |
277 |
if $self->{'lock_mode'} eq 'exclusive' |
85
|
1 |
1 |
if (@_) { } |
116
|
110 |
691 |
if ($self->{'period'}) { } |
117
|
13 |
97 |
if ($self->{'period'} =~ /year/i) { } |
|
13 |
84 |
elsif ($self->{'period'} =~ /month/) { } |
|
84 |
0 |
elsif ($self->{'period'} =~ /day|daily/) { } |
134
|
110 |
691 |
length $period ? : |
135
|
308 |
493 |
if (wantarray) { } |
149
|
4 |
588 |
if $self->{'lock_mode'} eq 'none' |
150
|
78 |
510 |
if defined $self->{'_weak_lock'} |
165
|
0 |
98 |
unless (opendir my $dh, $self->{'dir'}) |
172
|
1 |
462 |
if $e =~ s/(\.gz)\z// |
173
|
311 |
152 |
unless $e =~ /\A\Q$self->{'prefix'}\E
(?:\. (?\d{4}(?:-\d\d(?:-\d\d)?)?) )?
\Q$self->{'suffix'}\E
(?:\. (?\d+) )?
\z
/x |
184
|
0 |
70 |
unless $File::Write::Rotate::a->[2] cmp $File::Write::Rotate::b->[2] |
196
|
0 |
85 |
unless my $files = $self->_get_files |
203
|
0 |
85 |
if (-f "$self->{'dir'}/$self->{'prefix'}-compress.pid") |
209
|
7 |
78 |
if $self->{'hook_before_rotate'} |
216
|
53 |
32 |
@$files ? : |
230
|
22 |
100 |
if ($i <= @$files - $self->{'histories'}) |
231
|
0 |
22 |
if $Debug |
233
|
22 |
0 |
if (unlink "$dir/$orig$cs") { } |
240
|
48 |
17 |
if (not $delete_only and defined $rotating_period and $period eq $rotating_period) |
242
|
14 |
34 |
if ($rs) { } |
247
|
48 |
0 |
if ($new ne $orig) |
248
|
0 |
48 |
if $Debug |
250
|
48 |
0 |
if (rename "$dir/$orig$cs", "$dir/$new$cs") { } |
260
|
7 |
78 |
if $self->{'hook_after_rotate'} |
268
|
0 |
298 |
unless open $self->{'_fh'}, '>>', $fp |
269
|
2 |
296 |
if (defined $self->{'binmode'}) |
271
|
0 |
2 |
unless binmode $self->{'_fh'}, $self->{'binmode'} |
277
|
7 |
291 |
if $self->{'hook_after_create'} |
291
|
0 |
0 |
if ($self->{'rotate_probability'} and $self->{'_fh'}) |
292
|
0 |
0 |
if rand() > $self->{'rotate_probability'} |
296
|
50 |
443 |
unless (-e $fp) |
304
|
219 |
224 |
unless ($self->{'_fh'}) |
309
|
0 |
443 |
if ($self->{'_fp'} ne $fp) |
318
|
437 |
6 |
if ($self->{'size'} > 0) |
324
|
28 |
409 |
if ($size >= $self->{'size'}) { } |
325
|
0 |
28 |
if $Debug |
332
|
0 |
409 |
unless @st |
338
|
1 |
408 |
if (defined $inode and $finode != $inode) |
346
|
78 |
415 |
if $do_rotate |
347
|
79 |
414 |
if $do_rotate or $do_open |
367
|
13 |
480 |
if $self->{'hook_before_write'} |
375
|
5 |
488 |
if ($err) |
376
|
4 |
1 |
if (($self->{'buffer_size'} // 0) > @{$self->{'_buffer'};}) { } |
388
|
1 |
0 |
@{$self->{'_buffer'};} ? : |
406
|
13 |
0 |
if (@{$files_ref;}) |
416
|
0 |
13 |
if ($pid->alive) { } |
424
|
0 |
30 |
if $cs |
425
|
5 |
5 |
unless $self->{'period'} or $rs |
426
|
8 |
17 |
if $self->{'period'} and $period eq $latest_period |
430
|
13 |
0 |
if (@tocompress) |
433
|
0 |
17 |
unless (gzip($file, "$file.gz")) |