Branch Coverage

blib/lib/File/Replace.pm
Criterion Covered Total %
branch 153 158 98.1


line true false branch
25 8 0 if ($] ge '5.010' or defined &Hash::Util::lock_ref_keys) { }
43 5 6 if $_[$i] =~ /^-i|^-D$/
44 2 10 if (@mine and my(@i) = grep({/^-i/;} @mine))
45 1 1 if @i > 1
48 0 1 unless my($ext) = $i[0] =~ /^-i(.*)$/
63 3 161 unless @_
66 7 154 @_ % 2 ? :
69 24 123 unless $NEW_KNOWN_OPTS{$_}
71 1 12 if $opts{'autocancel'} and $opts{'autofinish'}
72 1 135 unless (defined wantarray)
73 17 118 if (defined $opts{'create'}) { }
74 4 13 if ($opts{'create'} eq 'off' or $opts{'create'} eq 'no') { }
10 3 elsif ($opts{'create'} eq 'now' or $opts{'create'} eq 'later') { }
83 1 131 if $self->{'debug'} and not ref $self->{'debug'}
84 7 125 if (defined $_layers)
85 1 6 if exists $self->{'layers'}
90 4 127 if defined $self->{'perms'}
95 8 123 if defined $self->{'layers'}
98 8 123 defined $self->{'layers'} ? :
99 5 126 if (defined $self->{'in_fh'}) { }
44 82 elsif (not open($self->{'ifh'}, $openmode, $filename)) { }
100 1 4 unless defined fileno $self->{'in_fh'}
105 41 3 if ($!{'ENOENT'} and $self->{'create'} eq 'now' || $self->{'create'} eq 'later') { }
106 1 2 defined $self->{'layers'} ? :
3 38 if $self->{'create'} eq 'now'
109 3 38 $self->{'create'} eq 'now' ? :
41 0 if (open $self->{'ifh'}, $openmode, $self->{'create'} eq 'now' ? $filename : &devnull()) { }
110 40 1 unless defined $self->{'setperms'}
114 3 127 if (not defined $self->{'ifh'}) { }
121 83 44 unless (defined $self->{'setperms'})
122 81 2 if ($self->{'chmod'}) { }
126 1 80 unless my(undef, undef, $mode) = stat $self->{'ifh'}
135 5 121 if (defined $self->{'backup'} and length $self->{'backup'})
137 1 4 if ($self->{'backup'} =~ /\*/)
141 1 4 if -e $bakfile
143 1 3 unless File::Copy::syscopy($filename, $bakfile)
151 8 116 defined $self->{'layers'} ? :
157 1 3 unless (defined wantarray)
164 1 20 unless (defined wantarray)
167 15 3 if (wantarray) { }
178 1 16 unless (defined wantarray)
193 21 42 if exists $self->{$o}
194 1 6 wantarray ? :
201 1 22 unless $self->{'is_open'}
202 14 8 @_ % 2 ? :
204 14 8 if (defined $_count)
205 1 13 if exists $opts{'count'}
208 1 31 unless $COPY_KNOWN_OPTS{$_}
209 15 5 unless defined $opts{'bufsize'}
210 2 18 unless $opts{'count'} and $opts{'count'} =~ /\A\d+\z/
211 2 16 unless $opts{'bufsize'} and $opts{'bufsize'} =~ /\A\d+\z/
213 1 15 if defined $opts{'less'} and not $opts{'less'} =~ /\A(?:ok|ignore)\z/
217 6 9 $remain > $opts{'bufsize'} ? :
218 1 14 unless defined $in
219 1 13 unless print {$self->{'ofh'};} $buf
223 3 10 if $remain and not $opts{'less'}
229 1 101 if @_
230 4 98 unless ($self->{'is_open'})
238 3 95 if (defined fileno $ifh and not close $ifh) { }
3 92 elsif (defined fileno $ofh and not close $ofh) { }
0 92 elsif ($self->{'chmod'} and not chmod($self->{'setperms'}, $ofn)) { }
0 92 elsif (not rename($ofn, $ifn)) { }
246 6 92 if (defined $fail)
258 133 20 if ($from eq 'destroy') { }
18 2 elsif ($from eq 'cancel') { }
260 8 125 if $self->{'is_open'}
262 2 16 unless $self->{'is_open'}
263 28 125 unless ($from eq 'destroy' and not $self->{'is_open'})
266 26 2 defined $self->{'ifn'} ? :
26 2 defined $self->{'ofn'} ? :
270 3 26 unless defined $ifh and defined fileno $ifh and close $ifh
271 3 27 unless defined $ofh and defined fileno $ofh and close $ofh
272 30 123 if defined $ofn
273 23 130 if ($success) { }
280 22 111 if ($self->{'is_open'})
281 10 12 if ($self->{'autocancel'}) { }
4 8 elsif ($self->{'autofinish'}) { }
290 278 10 unless $self->{'debug'}
291 1 9 unless @_