diff options
author | Brad Gilbert <b2gills@gmail.com> | 2010-12-07 17:16:56 -0600 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-12-08 11:17:35 -0800 |
commit | 55b0687d8bc1aa7e911b5fd2678ea7e8dbe6f059 (patch) | |
tree | 0ead22809e28c21de7932d3bac77e851972a6714 | |
parent | 96fedf7b439670394f9a08f3e777580fd85ef6cf (diff) | |
download | perl-55b0687d8bc1aa7e911b5fd2678ea7e8dbe6f059.tar.gz |
Modified unlink_all in t/test.pl to return the count of unlinked files This will make it so that it can be a drop-in replacement for unlink
-rw-r--r-- | t/test.pl | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -630,10 +630,16 @@ sub which_perl { } sub unlink_all { + my $count = 0; foreach my $file (@_) { 1 while unlink $file; - _print_stderr "# Couldn't unlink '$file': $!\n" if -f $file; + if( -f $file ){ + _print_stderr "# Couldn't unlink '$file': $!\n"; + }else{ + ++$count; + } } + $count; } my %tmpfiles; |