Branch Coverage

blib/lib/File/Trash/FreeDesktop.pm
Criterion Covered Total %
branch 93 128 72.6


line true false branch
21 0 2 unless my $home = "File::HomeDir::FreeDesktop"->my_home
33 3 48 unless (-d $d)
35 0 3 unless mkdir $d, 448
49 2 32 unless (-d $d)
50 0 2 unless mkdir $d
60 0 17 unless file_exists($file0)
66 2 15 if -l $file0
69 0 17 if ($ENV{'PERL_FILE_TRASH_FREEDESKTOP_DEBUG'})
76 0 17 if ($ENV{'PERL_FILE_TRASH_FREEDESKTOP_DEBUG'})
81 17 0 if ($self->{'_home_mp'} eq $file_mp)
90 0 0 $file_mp eq '/' ? :
92 0 0 unless (-w $dir)
93 0 0 if ($ENV{'PERL_FILE_TRASH_FREEDESKTOP_DEBUG'})
99 0 0 if ($dir ne $file_mp)
101 0 0 unless $mp eq $file_mp
103 0 0 $dir eq '/' ? :
125 20 1 $self->{'home_only'} ? :
142 0 38 unless $content =~ /\A\[Trash Info\]/m
144 0 38 unless $content =~ /^Path=(.+)/m
148 0 38 unless ($content =~ /^DeletionDate=(\d{4})-?(\d{2})-?(\d{2})T(\d\d):(\d\d):(\d\d)$/m)
151 0 38 unless ($res->{'deletion_date'} = Time::Local::timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900))
160 24 2 if (ref $_[0] eq 'HASH') { }
167 5 21 $trash_dir0 ? :
175 1 25 unless (opendir my $dh, "$trash_dir/info")
178 50 38 unless $e =~ /\.trashinfo$/
181 0 38 unless open my $fh, "<", $ifile
186 0 38 unless ref $parse_res
189 2 36 if (defined $opts->{'path'})
190 1 1 unless $parse_res->{'path'} eq $opts->{'path'}
192 2 35 if (defined $opts->{'path_wildcard'})
193 1 1 unless (defined $path_wc_re)
197 1 1 unless $parse_res->{'path'} =~ /$path_wc_re/
199 2 34 if (defined $opts->{'path_re'})
200 1 1 unless $parse_res->{'path'} =~ /$opts->{'path_re'}/
204 21 14 if (defined $opts->{'filename'})
205 3 18 unless $filename eq $opts->{'filename'}
207 4 28 if (defined $opts->{'filename_wildcard'})
208 2 2 unless (defined $filename_wc_re)
212 1 3 unless $filename =~ /$filename_wc_re/
214 4 27 if (defined $opts->{'filename_re'})
215 1 3 unless $filename =~ /$opts->{'filename_re'}/
221 3 27 if (defined $opts->{'mtime'})
223 1 2 unless not @st or $st[9] == $opts->{'mtime'}
225 5 24 if (defined $opts->{'suffix'})
226 2 3 unless $afile =~ /\.\Q$opts->{'suffix'}\E\z/
237 0 0 unless $File::Trash::FreeDesktop::a->{'deletion_date'} <=> $File::Trash::FreeDesktop::b->{'deletion_date'}
245 3 16 if (ref $_[0] eq 'HASH') { }
253 2 17 unless (file_exists($file0))
254 1 1 if ($opts->{'on_not_found'} eq 'ignore') { }
264 0 17 unless length $name0
267 2 15 defined $opts->{'suffix'} ? :
270 2 15 $i > 1 ? :
2 17 defined $opts->{'suffix'} ? :
273 17 2 if sysopen $fh, $tinfo, 193
274 0 2 if $i >= $limit
284 0 17 unless close $fh
287 0 17 unless (rename $afile, $tfile)
298 7 6 if (ref $_[0] eq 'HASH') { }
312 3 12 if (file_exists($e->{'path'}))
313 1 2 if ($opts->{'on_target_exists'} eq 'ignore') { }
323 0 12 unless (rename $tfile, $afile)
339 0 4 unless unlink $f
350 1 1 ref $_[0] eq 'HASH' ? :
358 0 0 unless (defined $file or defined $opts->{'filename'} or defined $opts->{'filename_wildcard'} or defined $opts->{'filename_re'} or defined $opts->{'path'} or defined $opts->{'path_wildcard'} or defined $opts->{'path_re'})