Branch Coverage

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


line true false branch
32 1 31 unless eval { do { $config->url } }
59 277 1 $self->{'ua'} ? :
68 1076 34 if defined $self->{'our_url'} and keys %{$$self{'bucket_to_root'};} > 0 and keys %{$$self{'bucket_to_url'};} > 0
70 0 34 unless $self->{'our_url'} ||= $config->url
77 176 352 unless $server->{'url'} eq $self->{'our_url'}
79 0 352 unless defined $disk->{'root'}
87 32 2 unless (-e $state_file)
92 0 34 unless -e $state_file
99 0 341 unless opendir DIR, $dir
101 13 656 unless (/^\.\.?$/)
114 0 940 unless (keys %{$$self{'bucket_to_root'};})
116 0 0 unless keys %{$$self{'bucket_to_root'};} > 0
119 87 853 unless defined $bucket
120 87 853 unless defined $bucket
127 0 0 unless keys %{$$self{'bucket_to_root'};}
129 0 0 unless ref $_
135 0 321 unless $self->{'state_file'} and -e $self->{'state_file'}
137 297 24 if $self->{'_state'}{'mod_time'} and $self->{'_state'}{'mod_time'} == &Yars::Tools::stat($self->{'state_file'})->mtime
139 0 24 unless -e $self->{'state_file'}
155 0 35 unless rename "$temp", $self->{'state_file'}
163 0 318 if -d $root and not -w $root
164 292 26 if ($class->_state->{'disks'}{$root} || 'up') eq 'up'
172 2 10 unless $self->disk_is_up($root)
177 7 3 unless (-d $tmpdir)
185 0 10 if -z $temp->filename
188 0 10 if (my $error = $@) { }
217 0 0 if (exists $self->{'server_status_cache'}{$server_url} and $self->{'server_status_cache'}{$server_url}{'checked'} > time - $self->{'server_status_cache_lifetime'})
223 0 0 if (my $res = $tx->success)
225 0 0 if (defined $got->{'server_version'} and length $got->{'server_version'})
241 0 0 unless (-d $dir)
244 0 0 if ($@)
245 0 0 unless $ok
247 0 0 unless open my $fp, ">>$path"
256 0 3 if $class->disk_is_down($root)
259 0 3 unless exists $state->{'disks'}{$root}
261 3 0 if $class->_write_state($state)
269 0 0 if $class->disk_is_up($root)
273 0 0 if $class->_write_state($state)
283 0 1101 unless keys %{$$self{'bucket_to_url'};} > 0
285 1030 1172 if $found = $self->{'bucket_to_url'}{uc substr($digest, 0, $i)}
286 71 1101 if $found = $self->{'bucket_to_url'}{lc substr($digest, 0, $i)}
312 66 52 if $server eq $self->{'our_url'}
313 0 52 if $server eq $assigned_server
316 6 46 if (my $res = $tx->success)
331 55 387 if -r "$dir/$filename"
340 0 1 exists $self->{'servers'}{$server_url} ? :
363 8 320 if $self->{'disk_is_local'}{$dir}
364 0 320 unless (rmdir $dir)
373 0 12 unless -d $dir
396 0 2 if ($asset->isa('Mojo::Asset::File')) { }