Branch Coverage

lib/App/MtAws/Journal.pm
Criterion Covered Total %
branch 148 172 86.0


line true false branch
47 0 1467 if %checkargs
54 1444 23 if (defined $self->{'root_dir'})
57 1444 0 unless substr($self->{'canon_root_dir'}, -1) eq '/'
60 0 1467 unless defined $self->{'journal_file'}
65 1456 11 unless defined $self->{'output_version'}
81 2 189 unless defined $args{'should_exist'}
82 0 189 unless length $self->{'journal_file'}
84 0 189 if $self->{'use_active_retrievals'}
87 1 188 if ($args{'should_exist'} and not -e $binary_filename) { }
163 25 elsif (-e $binary_filename) { }
92 0 161 unless &open_file(my $F, $self->{'journal_file'}, 'file_encoding', $self->{'journal_encoding'}, 'mode', '<')
95 0 1333 unless defined(my $line = readline $F)
97 5 1328 unless $line =~ s/\r?\n$//
101 0 156 unless close $F
112 0 16 unless &open_file($self->{'append_file'}, $self->{'journal_file'}, 'mode', '>>', 'file_encoding', $self->{'journal_encoding'})
119 1 13 unless $self->{'append_file'}
120 0 13 unless close $self->{'append_file'}
133 1146 1211 if (($ver, $time, $archive_id, $size, $mtime, $treehash, $relfilename) = $line =~ /^([ABC])\t([0-9]{1,20})\tCREATED\t(\S+)\t([0-9]{1,20})\t([+-]?[0-9]{1,20}|NONE)\t(\S+)\t(.*?)$/) { }
279 932 elsif (($ver, $time, $archive_id, $relfilename) = $line =~ /^([ABC])\t([0-9]{1,20})\tDELETED\t(\S+)\t(.*?)$/) { }
165 767 elsif (($ver, $time, $archive_id, $job_id) = $line =~ /^([ABC])\t([0-9]{1,20})\tRETRIEVE_JOB\t(\S+)\t(.*?)$/) { }
278 489 elsif (($time, $archive_id, $size, $treehash, $relfilename) = $line =~ /^([0-9]{1,20}) CREATED (\S+) ([0-9]{1,20}) (\S+) (.*?)$/) { }
92 397 elsif (($archive_id, $relfilename) = $line =~ /^[0-9]{1,20}\s+DELETED\s+(\S+)\s+(.*?)$/) { }
68 329 elsif (($time, $archive_id) = $line =~ /^([0-9]{1,20})\s+RETRIEVE_JOB\s+(\S+)$/) { }
256 73 elsif ($line =~ /^([0-9]{1,20}) / or $line =~ /^[A-$self->{'last_supported_version'}]\t/) { }
23 50 elsif ($line =~ /^[$self->{'first_unsupported_version'}-Z]\t/) { }
135 0 1146 unless is_relative_filename($relfilename)
138 106 1040 if ($ver eq 'A') { }
139 1 105 if $mtime eq 'NONE'
145 18 87 if $archive_id eq $relfilename
147 2 1038 if $mtime eq 'NONE'
151 1125 20 defined $mtime ? :
159 293 852 unless $self->{'used_versions'}{$ver}
162 165 114 unless $self->{'used_versions'}{$ver}
165 165 0 unless $self->{'used_versions'}{$ver}
171 0 278 unless is_relative_filename($relfilename)
180 92 186 unless $self->{'used_versions'}{'0'}
183 68 24 unless $self->{'used_versions'}{'0'}
186 68 0 unless $self->{'used_versions'}{'0'}
202 1393 143 if ($self->check_filenames($args->{'relfilename'}))
203 1 1392 if $self->{'archive_h'}{$args->{'archive_id'}}
211 2 145 unless defined $archive_id and defined $relfilename
213 142 3 if ($self->{'archive_h'}{$archive_id}) { }
216 2 1 if $self->check_filenames($relfilename)
225 20 1044 if ($self->{'journal_h'}{$relfilename}) { }
226 13 7 if (ref $self->{'journal_h'}{$relfilename} eq ref {}) { }
248 21 3 if ($self->{'use_active_retrievals'} and $self->{'last_read_time'} - $time < 86400)
250 18 3 if (not $r->{$archive_id} or $r->{$archive_id}{'time'} < $time)
259 1 138 unless my $e = $self->{'journal_h'}{$relfilename}
260 133 5 ref $e eq ref {} ? :
271 0 47 unless $self->{'output_version'} eq 'B'
275 45 2 if ($e->{'type'} eq 'CREATED') { }
1 1 elsif ($e->{'type'} eq 'DELETED') { }
1 0 elsif ($e->{'type'} eq 'RETRIEVE_JOB') { }
278 0 45 unless is_relative_filename($e->{'relfilename'})
279 44 1 defined $e->{'mtime'} ? :
284 0 1 unless is_relative_filename($e->{'relfilename'})
298 1 46 unless $self->{'append_file'}
299 0 46 unless print {$self->{'append_file'};} $line . "\n"
314 0 240 if %checkmode
316 0 240 unless defined $self->{'root_dir'}
318 23 217 $mode->{'missing'} ? :
327 3 2757 if ($self->_listing_exceeed_max_number_of_files($max_number_of_files))
332 0 2757 if (++$i % 1000 == 0)
337 3 2754 if /[\r\n\t]/
340 1042 1712 if (-d $_) { }
344 600 442 if ($self->{'filter'} and $reldir ne '.')
346 120 480 if (not $match and $matchsubdirs)
354 1443 268 if ($self->check_filenames($orig_relfilename))
355 1413 30 if ($self->_is_file_exists($binaryfilename))
357 0 1413 unless defined($relfilename = sanity_relative_filename($orig_relfilename))
359 1120 293 if (my $use_mode = $self->_can_read_filename_for_mode($orig_relfilename, $mode))
362 84 1329 if $mode->{'missing'}
366 32 208 $self->{'follow'} ? :
368 22 214 if ($mode->{'missing'} and not $self->_listing_exceeed_max_number_of_files($max_number_of_files))
370 42 4 unless ($self->_is_file_exists(&binaryfilename(scalar $self->absfilename($_))))
372 3 39 if $self->_listing_exceeed_max_number_of_files($max_number_of_files)
385 98 2727 if $max_number_of_files
397 1 2753 unless defined($filename = eval { do { &decode($enc, $binaryfilename, &Encode::DIE_ON_ERR() | &Encode::LEAVE_SRC()) } })
404 1269 9 if -f $filename
410 0 1221 unless defined $self->{'canon_root_dir'}
423 521 893 if (defined $self->{'journal_h'}{$relfilename}) { }
424 279 242 if ($mode->{'existing'}) { }
235 7 elsif ($mode->{'new'}) { }
433 845 48 if ($mode->{'new'}) { }
39 9 elsif ($mode->{'existing'}) { }
447 1905 1345 unless not $self->{'filter'}