Branch Coverage

blib/lib/File/Trash/FreeDesktop.pm
Criterion Covered Total %
branch 96 130 73.8


line true false branch
21 0 2 unless my $home = "File::HomeDir::FreeDesktop"->my_home
33 3 33 unless (-d $d)
35 0 3 unless mkdir $d, 448
49 2 22 unless (-d $d)
50 0 2 unless mkdir $d
60 0 12 unless file_exists($file0)
66 2 10 if -l $file0
69 0 12 if ($ENV{'PERL_FILE_TRASH_FREEDESKTOP_DEBUG'})
76 0 12 if ($ENV{'PERL_FILE_TRASH_FREEDESKTOP_DEBUG'})
81 12 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 '/' ? :
140 0 33 unless $content =~ /\A\[Trash Info\]/m
142 0 33 unless $content =~ /^Path=(.+)/m
146 0 33 unless ($content =~ /^DeletionDate=(\d{4})-?(\d{2})-?(\d{2})T(\d\d):(\d\d):(\d\d)$/m)
149 0 33 unless ($res->{'deletion_date'} = Time::Local::timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900))
158 23 2 if (ref $_[0] eq 'HASH') { }
165 5 20 $trash_dir0 ? :
173 1 24 unless (opendir my $dh, "$trash_dir/info")
176 48 33 unless $e =~ /\.trashinfo$/
179 0 33 unless open my $fh, "<", $ifile
184 0 33 unless ref $parse_res
187 20 13 if (defined $opts->{'path'})
188 3 17 unless $parse_res->{'path'} eq $opts->{'path'}
190 2 28 if (defined $opts->{'path_wildcard'})
191 1 1 unless (defined $path_wc_re)
195 1 1 unless $parse_res->{'path'} =~ /$path_wc_re/
197 2 27 if (defined $opts->{'path_re'})
198 1 1 unless $parse_res->{'path'} =~ /$opts->{'path_re'}/
202 2 26 if (defined $opts->{'filename'})
203 1 1 unless $filename eq $opts->{'filename'}
205 2 25 if (defined $opts->{'filename_wildcard'})
206 1 1 unless (defined $filename_wc_re)
210 1 1 unless $filename =~ /$filename_wc_re/
212 2 24 if (defined $opts->{'filename_re'})
213 1 1 unless $filename =~ /$opts->{'filename_re'}/
219 5 20 if (defined $opts->{'mtime'})
221 3 2 unless not @st or $st[9] == $opts->{'mtime'}
223 5 17 if (defined $opts->{'suffix'})
224 3 2 unless $afile =~ /\.\Q$opts->{'suffix'}\E\z/
235 0 0 unless $File::Trash::FreeDesktop::a->{'deletion_date'} <=> $File::Trash::FreeDesktop::b->{'deletion_date'}
243 3 11 if (ref $_[0] eq 'HASH') { }
251 2 12 unless (file_exists($file0))
252 1 1 if ($opts->{'on_not_found'} eq 'ignore') { }
262 0 12 unless length $name0
265 2 10 defined $opts->{'suffix'} ? :
268 2 10 $i > 1 ? :
2 12 defined $opts->{'suffix'} ? :
271 12 2 if sysopen $fh, $tinfo, 193
272 0 2 if $i >= $limit
282 0 12 unless close $fh
285 0 12 unless (rename $afile, $tfile)
296 9 7 if (ref $_[0] eq 'HASH') { }
305 3 13 if (file_exists($file0))
306 1 2 if ($opts->{'on_target_exists'} eq 'ignore') { }
319 4 9 unless (@res)
320 1 3 if ($opts->{'on_not_found'} eq 'ignore') { }
331 0 9 unless (rename $tfile, $afile)
341 1 3 defined $file0 ? :
348 0 2 unless unlink $f
360 0 1 unless defined $file