Branch Coverage

blib/lib/File/Flat.pm
Criterion Covered Total %
branch 159 258 61.6


line true false branch
42 6 0 if defined $_[1]
45 5 0 if defined $_[1]
48 6 0 if defined $_[1]
51 6 1 if defined $_[1] and -e $_[1]
57 9 18 if -e $_[1]
60 0 18 unless my $Object = 'File::Flat::Object'->new($_[1])
65 4 1 if defined $_[1] and -r $_[1]
68 10 0 if defined $_[1]
71 7 7 if defined $_[1] and -f $_[1]
76 0 0 unless my $Object = 'File::Flat::Object'->new($_[1])
81 2 3 if defined $_[1] and -f $_[1]
84 2 3 if defined $_[1] and -f $_[1]
90 1 9 unless my $file = shift()
93 2 7 unless -e $file
94 0 7 unless -f _
120 6 22 if (@_ == 1) { }
22 0 elsif (@_ == 2) { }
124 0 6 $file =~ s/^([<>+]{1,2})\s*// ? :
135 0 28 unless (exists $modes{$mode})
141 14 14 if ($modes{$mode} and not -e $file)
143 0 14 unless defined $remove_on_fail
147 5 23 unless 'IO::File'->new($file, $mode)
170 1 2 unless my $file = shift()
173 1 1 unless $class->canOpen($file)
177 0 1 unless _slurp($file)
185 0 1 unless CORE::open SLURP, "<$file"
187 0 1 unless close SLURP
196 2 4 unless my $file = shift()
199 2 2 unless ($class->canOpen($file))
205 0 2 unless (CORE::open FILE, $file)
213 1 1 wantarray ? :
221 1 20 unless my $file = shift()
222 2 18 unless (defined $_[0])
231 11 7 if (ref $_[0]) { }
232 0 11 unless (UNIVERSAL::isa($_[0], 'SCALAR') or UNIVERSAL::isa($_[0], 'ARRAY'))
246 12 6 if (ref $file) { }
251 0 6 unless $file = $class->getWriteHandle($file)
255 14 4 if (UNIVERSAL::isa($contents, 'SCALAR')) { }
256 0 14 unless $file->print($$contents)
262 0 16 unless $file->print($_ . "\n")
267 6 12 unless $dontclose
277 1 5 unless my $file = shift()
278 1 4 unless defined $_[0]
281 0 4 unless ($class->canWrite($file))
298 2 2 ref $_[0] ? :
0 4 unless ($class->write($handle, ref $_[0] ? $_[0] : \$_[0]))
309 0 4 unless (File::Copy::move($tempfile, $file))
322 1 6 unless my $file = shift()
323 1 5 unless defined $_[0]
326 0 5 unless my $handle = $class->getAppendHandle($file)
327 1 4 ref $_[0] ? :
0 5 unless ($class->write($handle, ref $_[0] ? $_[0] : \$_[0]))
341 2 12 unless defined $_[0] and defined $_[1]
342 0 12 unless my $source = 'File::Spec'->canonpath(shift())
343 0 12 unless my $target = 'File::Spec'->canonpath(shift())
346 1 11 unless -e $source
347 0 11 if (-e $target)
348 0 0 unless (-f $source and -f $target)
349 0 0 -f $target ? :
0 0 -f $source ? :
356 0 11 unless ($class->canWrite($target))
362 0 11 unless defined $remove_on_fail
364 10 1 if (-f $source)
367 10 0 File::Copy::copy($source, $target) ? :
372 0 1 unless my $tocopy = 'File::Spec'->catfile($source, '*')
373 0 1 unless (mkdir $target, 493)
381 1 0 defined $rv ? :
387 0 2 unless my $source = shift()
388 0 2 unless my $target = shift()
391 0 2 unless -e $source
392 0 2 if (-d $source and -f $target)
397 0 2 unless ($class->canWrite($target))
403 0 2 unless defined $remove_on_fail
408 0 2 unless ($rv)
410 0 0 if $remove_on_fail
420 1 17 unless my $file = shift()
423 1 16 unless (-e $file)
429 0 16 unless File::Remove::remove(\1, $file)
430 3 13 $AUTO_PRUNE || $_[0] ? :
435 0 8 unless my $Object = 'File::Flat::Object'->new($_[1])
443 1 5 unless my $file = shift()
444 2 3 defined $_[0] ? :
447 1 4 if -d $file
448 0 4 unless ($class->canWrite($file))
453 0 4 unless my $handle = $class->open('>', $file)
455 0 4 unless $handle->truncate($bytes)
475 0 5 unless my $Object = 'File::Flat::Object'->new($_[1])
481 0 27 unless my $Object = 'File::Flat::Object'->new($_[1])
499 0 5 if (length $to_remove)
504 0 5 @_ ? :
528 0 58 unless my $filename = shift()
555 0 58 $self->{'file'} eq '' ? :
564 0 0 if -e $_[0]{'original'}
565 0 0 if -e $_[0]{'original'}
566 0 0 if -e $_[0]{'original'} and -r _
567 0 0 if -e $_[0]{'original'}
568 0 0 if -f $_[0]{'original'}
577 18 0 unless defined $self->{'type'}
580 0 18 if -e $self->{'original'}
586 0 18 if $self->{'file'} eq ''
594 9 113 unless -e $fullpath
597 113 0 if (-d $fullpath)
608 0 18 unless -w $dir_known
612 9 9 @dirs ? :
622 0 0 if -e $_[0]{'original'} and -f _
625 0 0 if -e $_[0]{'original'} and -f _
641 0 0 defined $_[0] ? :
665 0 0 unless 'File::Flat'->move($self->{'original'}, $moveTo)
673 0 0 if $self->{'type'}
686 8 0 unless defined $self->{'type'}
689 1 7 if (-e $self->{'original'})
707 5 15 unless -e $dir
710 0 15 unless (-d $dir)
715 0 15 unless opendir PRUNEDIR, $dir
720 9 15 if $_ eq 'File::Spec'->curdir
721 8 7 if $_ eq 'File::Spec'->updir
729 0 8 unless 'File::Flat'->remove($dir)
751 0 5 if (-e $self->{'original'})
752 0 0 if -d $self->{'original'}
755 5 0 unless defined $self->{'type'}
759 0 5 unless defined $remove_on_fail
762 0 5 unless (mkdir $self->{'original'}, $mode)
777 0 32 if -e $self->{'original'}
778 27 5 unless defined $self->{'type'}
785 0 32 if $self->{'file'} eq ''
793 213 21 if (-e $fullpath) { }
795 0 213 unless -d $fullpath
798 0 21 unless (mkdir $dir_unknown, $mode)
803 12 9 unless $creation_root