Branch Coverage

blib/lib/Yars/Tools.pm
Criterion Covered Total %
branch 56 100 56.0


line true false branch
31 1 31 unless eval { do { $config->url } }
58 278 1 $self->{'ua'} ? :
67 1077 34 if defined $self->{'our_url'} and keys %{$$self{'bucket_to_root'};} > 0 and keys %{$$self{'bucket_to_url'};} > 0
69 0 34 unless $self->{'our_url'} ||= $config->url
76 176 352 unless $server->{'url'} eq $self->{'our_url'}
78 0 352 unless defined $disk->{'root'}
86 32 2 unless (-e $state_file)
91 0 34 unless -e $state_file
98 0 341 unless opendir DIR, $dir
100 13 656 unless (/^\.\.?$/)
113 0 940 unless (keys %{$$self{'bucket_to_root'};})
115 0 0 unless keys %{$$self{'bucket_to_root'};} > 0
118 87 853 unless defined $bucket
119 87 853 unless defined $bucket
126 0 0 unless keys %{$$self{'bucket_to_root'};}
128 0 0 unless ref $_
134 0 324 unless $self->{'state_file'} and -e $self->{'state_file'}
136 300 24 if $self->{'_state'}{'mod_time'} and $self->{'_state'}{'mod_time'} == &Yars::Tools::stat($self->{'state_file'})->mtime
138 0 24 unless -e $self->{'state_file'}
154 0 35 unless rename "$temp", $self->{'state_file'}
162 0 321 if -d $root and not -w $root
163 292 29 if ($class->_state->{'disks'}{$root} || 'up') eq 'up'
171 2 10 unless $self->disk_is_up($root)
176 7 3 unless (-d $tmpdir)
184 0 10 if -z $temp->filename
187 0 10 if (my $error = $@) { }
216 0 0 if (exists $self->{'server_status_cache'}{$server_url} and $self->{'server_status_cache'}{$server_url}{'checked'} > time - $self->{'server_status_cache_lifetime'})
222 0 0 if (my $res = $tx->success)
224 0 0 if (defined $got->{'server_version'} and length $got->{'server_version'})
240 0 0 unless (-d $dir)
243 0 0 if ($@)
244 0 0 unless $ok
246 0 0 unless open my $fp, ">>$path"
255 0 3 if $class->disk_is_down($root)
258 0 3 unless exists $state->{'disks'}{$root}
260 3 0 if $class->_write_state($state)
268 0 0 if $class->disk_is_up($root)
272 0 0 if $class->_write_state($state)
282 0 1101 unless keys %{$$self{'bucket_to_url'};} > 0
284 1030 1172 if $found = $self->{'bucket_to_url'}{uc substr($digest, 0, $i)}
285 71 1101 if $found = $self->{'bucket_to_url'}{lc substr($digest, 0, $i)}
311 67 53 if $server eq $self->{'our_url'}
312 0 53 if $server eq $assigned_server
315 6 47 if (my $res = $tx->success)
330 55 396 if -r "$dir/$filename"
339 0 1 exists $self->{'servers'}{$server_url} ? :
362 8 320 if $self->{'disk_is_local'}{$dir}
363 0 320 unless (rmdir $dir)
372 0 12 unless -d $dir
395 0 2 if ($asset->isa('Mojo::Asset::File')) { }