Branch Coverage

blib/lib/DataStore/CAS/Simple.pm
Criterion Covered Total %
branch 112 198 56.5


line true false branch
36 0 16 if @inval
41 0 16 unless (-d $path)
42 0 0 unless $create
44 0 0 unless mkdir $path
50 13 3 unless (-f catfile($path, "conf", "VERSION"))
51 1 12 unless $create
64 9 3 if ($setup) { }
68 2 1 unless $self->validate($self->hash_of_null)
85 20 61 if ($create_dirs) { }
89 2 40 if -d $path
90 0 40 unless mkdir $path
101 12 0 if ref $class
102 12 0 @_ == 1 ? :
104 0 12 unless defined $params{'path'}
105 0 12 unless -d $params{'path'}
108 1 11 unless $class->_is_dir_empty($params{'path'})
118 0 9 unless mkdir $conf_dir
127 0 9 if $] < "5.01"
130 0 9 if (not $_->VERSION) { }
143 12 0 if ref $class
150 12 0 unless ($flags->{'ignore_version'})
153 0 12 unless defined $cur_ver
157 0 12 unless &try(sub { $pkg->VERSION($ver); 1; } , &catch(sub { 0; } ))
180 0 0 $len == $rawlen ? :
0 0 $len == $hexlen ? :
189 12 0 $fanout->[-1] =~ /^[0-9]+$/ ? :
192 12 0 if $filename_type eq "*"
196 0 0 if $hexlen != (length $hash || 0)
197 0 0 unless my(@dirs) = $hash =~ /$re/
202 0 81 if $hexlen != (length $hash || 0)
203 0 81 unless my(@dirs) = $hash =~ /$re/
206 12 0 $filename_type eq '*' ? :
0 12 $filename_type eq '=' ? :
218 0 0 unless defined $tmp
225 0 12 unless opendir my $dh, $path
227 14 12 if $_ ne "."
240 0 27 unless open my $f, ">", $path
242 0 27 unless print $f $content and close $f
248 0 36 unless open my $f, "<", $path
252 0 36 unless defined $str and length $str
267 55 0 if ($_ =~ /^(\d+)$/) { }
0 0 elsif ($_ eq '=' or $_ eq '*') { }
269 1 54 if $1 > $max_sane_level_fanout
273 0 0 unless \$_ == \$fanout[-1]
278 1 21 if $total_digits > $max_sane_total_fanout
285 0 12 unless $digest =~ /^(\S+)$/
294 0 12 unless $line =~ /^([A-Za-z0-9:_]+) ([0-9.]+)/
306 18 15 unless my($size, $blksize) = (stat $fname)[7, 11]
324 0 9 unless defined $file and $is_cas_file || $is_filename
328 4 5 if ($flags->{'hardlink'} or $flags->{'move'} and not $is_cas_file)
329 3 0 $is_cas_file && $file->can('local_file') ? :
1 3 $is_filename ? :
332 4 0 if ($fname and -f $fname)
333 0 4 $flags->{'known_hashes'} ? :
336 3 0 if $is_cas_file and $flags->{'reuse_hash'}
340 1 3 if (-f $self->path_for_hash($hash))
342 0 1 if $flags->{'stats'}
344 0 1 if $flags->{'move'}
353 1 2 $flags->{'move'} ? :
3 0 if $flags->{'move'} ? $self->_try_put_move($fname, $flags) : $self->_try_put_hardlink($fname, $flags)
367 0 1 unless rename $file, $tmp
368 0 1 if (ref $file and ref($file)->isa("File::Temp"))
375 0 1 unless my($mode, $uid, $gid) = (stat $tmp)[2, 4, 5]
377 1 0 unless ($flags->{'dry_run'})
378 0 1 if $uid and $uid != $> or $gid and $gid != $)
380 1 0 if 292 != ($mode & 511)
382 0 1 unless rename $tmp, $dest
386 0 1 if ($flags->{'stats'})
404 0 2 unless defined $mode and not $mode & 146
407 0 2 unless !$uid || $uid == $> and !$gid || $gid == $)
412 0 2 unless $flags->{'dry_run'} or link $file, $dest
415 0 2 if ($flags->{'stats'})
428 1 17 unless defined $known_hash and length $known_hash
437 18 0 unless $data->{'dry_run'}
440 1 17 unless defined $data->{'hash'}
452 18 0 defined $data->{'dest_file'} ? :
455 9 9 if (defined $wrote and $wrote > 0)
459 1 8 if defined $data->{'digest'}
480 17 1 defined $data->{'hash'} ? :
483 18 0 if (defined $temp_file)
485 0 18 unless close $temp_file
497 1 17 if (-f $dest_name) { }
498 0 1 if ($flags->{'stats'})
504 0 17 unless chmod 0444, "$source_file"
510 0 17 unless $flags->{'dry_run'} or rename "$source_file", $dest_name or $self->path_for_hash($hash, 1) and rename $source_file, $dest_name
514 0 17 if ($flags->{'stats'})
527 1 2 unless -f $path
529 0 2 unless open my $fh, "<:raw", $path
532 1 1 $hash eq $hash2 ? :
539 0 0 if $flags and $flags->{'layer'}
540 0 2 unless open my $fh, $mode, $file->local_file
559 0 15 unless @dirstack
564 3 41 unless @dirstack
571 41 12 if (-d $fname) { }
576 12 0 if ($#dirstack == $#length and -f $fname)
588 1 0 if (-f $path) { }
590 1 0 unless $flags and $flags->{'dry_run'}
592 0 0 if $flags and $flags->{'stats'}
596 0 0 if $flags and $flags->{'stats'}