diff options
author | Salvatore Bonaccorso <carnil@debian.org> | 2018-10-04 21:31:52 +0200 |
---|---|---|
committer | Salvatore Bonaccorso <carnil@debian.org> | 2018-10-04 21:31:52 +0200 |
commit | b782ec2354cea07ed754a7c73f5890b9abd39f94 (patch) | |
tree | 9dfded87937b7fa5e42d80831d56e0c8c15d0fde | |
parent | c5b094082517e7ff5e72b089ccaaa7182bee3c1b (diff) | |
parent | 31297c0693dda7d6bd5283d3fb1845c6192e0964 (diff) |
Update upstream source from tag 'upstream/1.58'
Update to upstream version '1.58'
with Debian dir 475c3f388bd737552cece3c4e108ae3b4ff524f8
-rw-r--r-- | Build.PL | 69 | ||||
-rw-r--r-- | Changes | 209 | ||||
-rw-r--r-- | MANIFEST | 15 | ||||
-rw-r--r-- | META.json | 500 | ||||
-rw-r--r-- | META.yml | 334 | ||||
-rw-r--r-- | Makefile.PL | 19 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | dist.ini | 32 | ||||
-rw-r--r-- | lib/File/Remove.pm | 398 | ||||
-rw-r--r-- | t/00-compile.t | 19 | ||||
-rwxr-xr-x | t/01_compile.t | 4 | ||||
-rwxr-xr-x | t/02_directories.t | 214 | ||||
-rwxr-xr-x | t/03_deep_readonly.t | 76 | ||||
-rw-r--r-- | t/04_can_delete.t | 76 | ||||
-rw-r--r-- | t/05_links.t | 38 | ||||
-rw-r--r-- | t/06_curly.t | 8 | ||||
-rw-r--r-- | t/07_cwd.t | 70 | ||||
-rw-r--r-- | t/08_spaces.t | 64 | ||||
-rw-r--r-- | t/09_fork.t | 16 | ||||
-rw-r--r-- | t/release-cpan-changes.t | 19 | ||||
-rw-r--r-- | t/release-kwalitee.t | 19 | ||||
-rw-r--r-- | xt/author/eol.t | 25 | ||||
-rw-r--r-- | xt/author/no-tabs.t | 25 | ||||
-rw-r--r-- | xt/author/pod-coverage.t (renamed from t/author-pod-coverage.t) | 8 | ||||
-rw-r--r-- | xt/author/pod-syntax.t (renamed from t/author-pod-syntax.t) | 8 | ||||
-rw-r--r-- | xt/release/cpan-changes.t | 10 | ||||
-rw-r--r-- | xt/release/trailing-space.t (renamed from t/release-trailing-space.t) | 8 |
27 files changed, 1588 insertions, 702 deletions
diff --git a/Build.PL b/Build.PL new file mode 100644 index 0000000..898dfb5 --- /dev/null +++ b/Build.PL @@ -0,0 +1,69 @@ + +# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.012. +use strict; +use warnings; + +use Module::Build 0.28; + + +my %module_build_args = ( + "build_requires" => { + "Module::Build" => "0.28" + }, + "configure_requires" => { + "ExtUtils::MakeMaker" => 0, + "Module::Build" => "0.28" + }, + "dist_abstract" => "Remove files and directories", + "dist_author" => [ + "Shlomi Fish <shlomif\@cpan.org>" + ], + "dist_name" => "File-Remove", + "dist_version" => "1.58", + "license" => "perl", + "module_name" => "File::Remove", + "recursive_test_files" => 1, + "requires" => { + "Cwd" => "3.29", + "File::Glob" => 0, + "File::Path" => 0, + "File::Spec" => "3.29", + "constant" => 0, + "perl" => "5.006", + "strict" => 0, + "vars" => 0, + "warnings" => 0 + }, + "test_requires" => { + "File::Copy" => 0, + "File::Spec" => "3.29", + "File::Spec::Functions" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Test::More" => "0.88", + "perl" => "5.006" + } +); + + +my %fallback_build_requires = ( + "File::Copy" => 0, + "File::Spec" => "3.29", + "File::Spec::Functions" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Module::Build" => "0.28", + "Test::More" => "0.88", + "perl" => "5.006" +); + + +unless ( eval { Module::Build->VERSION(0.4004) } ) { + delete $module_build_args{test_requires}; + $module_build_args{build_requires} = \%fallback_build_requires; +} + +my $build = Module::Build->new(%module_build_args); + + +$build->create_build_script; @@ -1,5 +1,8 @@ Revision history for Perl extension File-Remove +1.58 2018-10-04 - Shlomi Fish + - Added [MetaJSON] to dist.ini, so releases include a META.json + 1.57 2016-04-24 - Shlomi Fish - Correct the copyright holder and year. - Add a test for Kwalitee and 'use warnings'. @@ -34,170 +37,170 @@ Revision history for Perl extension File-Remove - The \r-s confused Dist-Zilla abstract extraction. 1.52 2012-03-19 - Adam Kennedy - - No functional changes - - Updating Module::Install to 1.06 - - Moved File::Spec dependency to 3.29 to fix problems with - four-digit decimal dependencies in some downstream packaging - systems. + - No functional changes + - Updating Module::Install to 1.06 + - Moved File::Spec dependency to 3.29 to fix problems with + four-digit decimal dependencies in some downstream packaging + systems. 1.51 2011-10-27 - Adam Kennedy - - END-time deletion by clear() is now fork-safe, it will only remove - paths created in the same process. + - END-time deletion by clear() is now fork-safe, it will only remove + paths created in the same process. 1.50 2011-07-11 - Adam Kennedy - - Adding a second skip for the known-bad cygwin file permissions problem + - Adding a second skip for the known-bad cygwin file permissions problem 1.49 2011-03-14 - Adam Kennedy - - Restoring 02_directories to no_plan as it runs different test counts - on different systems. + - Restoring 02_directories to no_plan as it runs different test counts + on different systems. 1.48 2011-03-11 - Adam Kennedy - - Promoting dev code to production version - - Fixed a major bug in the 1.46 logic that works out what to change the - cwd to when deleting while inside a directory. + - Promoting dev code to production version + - Fixed a major bug in the 1.46 logic that works out what to change the + cwd to when deleting while inside a directory. 1.47_01 2011-02-18 - Adam Kennedy - - Add test counts to all test scripts - - Added a test for space-safe globs + - Add test counts to all test scripts + - Added a test for space-safe globs 1.46 2011-02-18 - Adam Kennedy - - No changes from 1.45_01 - - CPAN Testers likes the dev release, moving to production release + - No changes from 1.45_01 + - CPAN Testers likes the dev release, moving to production release 1.45_01 2011-02-17 - Adam Kennedy - - Updated to Module::Install::DSL 1.00 - - Skip test on cygwin due to non-root users not being able to deny - themselves write permissions to files. - - Added a test to delete directories when the current working - directory is inside the location to delete (ADAMK) - - Fixes for trash() with callbacks and on Mac (MIYAGAWA) + - Updated to Module::Install::DSL 1.00 + - Skip test on cygwin due to non-root users not being able to deny + themselves write permissions to files. + - Added a test to delete directories when the current working + directory is inside the location to delete (ADAMK) + - Fixes for trash() with callbacks and on Mac (MIYAGAWA) 1.42 2008-07-03 - Adam Kennedy - - Updated to Module::Install 0.76 - - Updated bundled author tests - - Added the test_remove function - - Localising $@ during eval calls + - Updated to Module::Install 0.76 + - Updated bundled author tests + - Added the test_remove function + - Localising $@ during eval calls 1.41 2008-06-02 - Adam Kennedy - - No functional changes - - Updating location of author tests - - Switching to Module::Install again, to generate a better META.yml + - No functional changes + - Updating location of author tests + - Switching to Module::Install again, to generate a better META.yml 1.40 2008-02-23 - Adam Kennedy - - Dev release looks good, changing to production release + - Dev release looks good, changing to production release 1.39_01 2008-02-20 - Adam Kennedy - - Fixed rt.cpan.org #30251 "removing dirs enclosed by curly braces" - - remove now ignores globbing if -e is true BEFORE globbing - (This should fix numerous possible failures where people are trying - delete strangely named files, but globbing is kicking in and - expanding the names incorrectly) - - Moving to a production-grade version to indicate module stability - - Adding explicit 5.005 dependency - (Primarily for the benefit of automated quality/anaylsis tools) + - Fixed rt.cpan.org #30251 "removing dirs enclosed by curly braces" + - remove now ignores globbing if -e is true BEFORE globbing + (This should fix numerous possible failures where people are trying + delete strangely named files, but globbing is kicking in and + expanding the names incorrectly) + - Moving to a production-grade version to indicate module stability + - Adding explicit 5.005 dependency + (Primarily for the benefit of automated quality/anaylsis tools) 0.39 2007-11-12 - Adam Kennedy - - No functional changes - - Updating to Module::Install 0.68 + - No functional changes + - Updating to Module::Install 0.68 0.38 2007-10-15 - Adam Kennedy - - Removed an extremely dangerous and reckless test case that tried - to delete a soft link to root and (when it failed) deleted the - actual root directory. + - Removed an extremely dangerous and reckless test case that tried + to delete a soft link to root and (when it failed) deleted the + actual root directory. 0.37 2007-07-08 - Adam Kennedy - - Restoring support for broken symlinks (Marek Rouchal) - - Adding tests for the broken symlink case (Marek Rouchal) - - Tidying up the Changes file a bit + - Restoring support for broken symlinks (Marek Rouchal) + - Adding tests for the broken symlink case (Marek Rouchal) + - Tidying up the Changes file a bit 0.36 2007-06-30 - Adam Kennedy - - Avoid the installation of Mac::Glue. - (It should not be necesary to test voice synthesis to delete a file) - - Anyone truly needing "trash" support will need to add a dependency - on Mac::Glue themself. The function may be split out of File::Remove - later down the track. - - Constanting the debugger flag for a minor speed and memory improvement - - Copy in a known-readonly flag for more accurate testing on Win32 - - Remove assumption that -w implied deletion rights on Win32 - - Validate that the file was actually deleted. - - Add better mode-handling for files. - - Add smarter implementation of "candelete" logic. + - Avoid the installation of Mac::Glue. + (It should not be necesary to test voice synthesis to delete a file) + - Anyone truly needing "trash" support will need to add a dependency + on Mac::Glue themself. The function may be split out of File::Remove + later down the track. + - Constanting the debugger flag for a minor speed and memory improvement + - Copy in a known-readonly flag for more accurate testing on Win32 + - Remove assumption that -w implied deletion rights on Win32 + - Validate that the file was actually deleted. + - Add better mode-handling for files. + - Add smarter implementation of "candelete" logic. 0.35 2007-02-09 - - Update makefile to require Mac::Glue version compatible with Intel macs - - Change pod heading from "methods" to "subroutines" [RT#13687] - - No functional changes from 0.34 + - Update makefile to require Mac::Glue version compatible with Intel macs + - Change pod heading from "methods" to "subroutines" [RT#13687] + - No functional changes from 0.34 0.34 2006-11-06 - - Update t/03 to skip the "is this file not writable" test when - it would fail because the tests are being run by root (as sometimes - happens when installing Perl modules). + - Update t/03 to skip the "is this file not writable" test when + it would fail because the tests are being run by root (as sometimes + happens when installing Perl modules). 0.33 2006-10-24 - - Previous release tested ok. - - Incrementing for production release. - - No functional changes + - Previous release tested ok. + - Incrementing for production release. + - No functional changes 0.32_01 2006-10-23 - - Use File::Spec to clean/canon paths instead of hand-stripping trailing slash - - Apply the File::Path "safe" check manually for the root only, and - use File::Path itself with safe OFF, so that we can handle deleting - deep readonly files (and do it properly on VMS) - - Added a test for the deletion of deep readonly files - - Removing the use of "our" variables to try and get the Perl version - dependency back to at least 5.005. - - Report "deleted" for non-existant files they want to delete - - Report the path they pass, but for dir USE a File::Spec->canonpath + - Use File::Spec to clean/canon paths instead of hand-stripping trailing slash + - Apply the File::Path "safe" check manually for the root only, and + use File::Path itself with safe OFF, so that we can handle deleting + deep readonly files (and do it properly on VMS) + - Added a test for the deletion of deep readonly files + - Removing the use of "our" variables to try and get the Perl version + dependency back to at least 5.005. + - Report "deleted" for non-existant files they want to delete + - Report the path they pass, but for dir USE a File::Spec->canonpath 0.31 2005-12-28 - - Applied Eric Hanchrow's patch to support filenames with spaces. - - Skip recycle tests unless recycle/trash support is available. + - Applied Eric Hanchrow's patch to support filenames with spaces. + - Skip recycle tests unless recycle/trash support is available. 0.30 2005-07-14 - - Applied CNANDOR's patch to fix trash() support on OS X 10.4. + - Applied CNANDOR's patch to fix trash() support on OS X 10.4. 0.29 2004-12-04 - - Stabilize undelete support for OS X and Windows. + - Stabilize undelete support for OS X and Windows. 0.26 2004-11-16 - - Fix the synopsis. + - Fix the synopsis. 0.25 2004-11-15 - - Renamed undelete() to trash(), to be more clear. - - Allow users to provide their own rmdir/unlink to trash(). - - Re-disabled debugging by default. + - Renamed undelete() to trash(), to be more clear. + - Allow users to provide their own rmdir/unlink to trash(). + - Re-disabled debugging by default. 0.24 2004-11-15 - - Add undelete support for OS X (via Mac::Glue). - - Fix undelete overloading of unlink/rmdir and update tests. - - Fix the documentation to be readable with perldoc. + - Add undelete support for OS X (via Mac::Glue). + - Fix undelete overloading of unlink/rmdir and update tests. + - Fix the documentation to be readable with perldoc. 0.23 2004-11-15 - - Add undelete supportand tests (currently only for Win32, via - Win32::FileOp). + - Add undelete supportand tests (currently only for Win32, via + Win32::FileOp). 0.22 2004-11-15 - - Add the first set of tests. + - Add the first set of tests. 0.21 2004-07-20 - - Converted the internals to File::Spec. - - Maintenance transferred by modules@perl.org to Richard Soderberg. - Please e-mail bug reports to <bug-File-Remove@rt.cpan.org>. + - Converted the internals to File::Spec. + - Maintenance transferred by modules@perl.org to Richard Soderberg. + Please e-mail bug reports to <bug-File-Remove@rt.cpan.org>. 0.20 1998-04-15 - - Now you can pass a scalar reference as the first argument and it - will used as the recursive flag when removing directories. With - recursive flag set to 0 only the files in the directory are - removed and no attempt is made to recurse into subdirectories. - Nevertheless, if the directory becomes empty it is removed. + - Now you can pass a scalar reference as the first argument and it + will used as the recursive flag when removing directories. With + recursive flag set to 0 only the files in the directory are + removed and no attempt is made to recurse into subdirectories. + Nevertheless, if the directory becomes empty it is removed. 0.12 1998-04-14 - - change the umask and set the permission on directories so we can - remove the files + - change the umask and set the permission on directories so we can + remove the files 0.11 1998-04-13 - - changed the return values to successes rather than failures since - it makes more sense. + - changed the return values to successes rather than failures since + it makes more sense. 0.10 1998-04-10 - - original version + - original version @@ -1,8 +1,10 @@ -# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.046. +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. +Build.PL Changes LICENSE MANIFEST MANIFEST.SKIP +META.json META.yml Makefile.PL README @@ -19,9 +21,10 @@ t/07_cwd.t t/08_spaces.t t/09_fork.t t/10_noglob.t -t/author-pod-coverage.t -t/author-pod-syntax.t -t/release-cpan-changes.t -t/release-kwalitee.t -t/release-trailing-space.t weaver.ini +xt/author/eol.t +xt/author/no-tabs.t +xt/author/pod-coverage.t +xt/author/pod-syntax.t +xt/release/cpan-changes.t +xt/release/trailing-space.t diff --git a/META.json b/META.json new file mode 100644 index 0000000..38a11ab --- /dev/null +++ b/META.json @@ -0,0 +1,500 @@ +{ + "abstract" : "Remove files and directories", + "author" : [ + "Shlomi Fish <shlomif@cpan.org>" + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "File-Remove", + "prereqs" : { + "build" : { + "requires" : { + "Module::Build" : "0.28" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "Module::Build" : "0.28" + } + }, + "develop" : { + "requires" : { + "Pod::Coverage::TrustPod" : "0", + "Test::CPAN::Changes" : "0.19", + "Test::EOL" : "0", + "Test::More" : "0.96", + "Test::NoTabs" : "0", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08", + "Test::TrailingSpace" : "0.0203" + } + }, + "runtime" : { + "requires" : { + "Cwd" : "3.29", + "File::Glob" : "0", + "File::Path" : "0", + "File::Spec" : "3.29", + "constant" : "0", + "perl" : "5.006", + "strict" : "0", + "vars" : "0", + "warnings" : "0" + } + }, + "test" : { + "requires" : { + "File::Copy" : "0", + "File::Spec" : "3.29", + "File::Spec::Functions" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Test::More" : "0.88", + "perl" : "5.006" + } + } + }, + "provides" : { + "File::Remove" : { + "file" : "lib/File/Remove.pm", + "version" : "1.58" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "mailto" : "bug-file-remove@rt.cpan.org", + "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove" + }, + "homepage" : "http://metacpan.org/release/File-Remove", + "repository" : { + "type" : "git", + "url" : "git://github.com/shlomif/File-Remove.git", + "web" : "https://github.com/shlomif/File-Remove" + } + }, + "version" : "1.58", + "x_Dist_Zilla" : { + "perl" : { + "version" : "5.028000" + }, + "plugins" : [ + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "test", + "type" : "requires" + } + }, + "name" : "@Filter/TestMoreDoneTesting", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::AutoPrereqs", + "name" : "@Filter/AutoPrereqs", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ExecDir", + "name" : "@Filter/ExecDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::GatherDir", + "config" : { + "Dist::Zilla::Plugin::GatherDir" : { + "exclude_filename" : [], + "exclude_match" : [], + "follow_symlinks" : 0, + "include_dotfiles" : 0, + "prefix" : "", + "prune_directory" : [], + "root" : "." + } + }, + "name" : "@Filter/GatherDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ManifestSkip", + "name" : "@Filter/ManifestSkip", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaYAML", + "name" : "@Filter/MetaYAML", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PruneCruft", + "name" : "@Filter/PruneCruft", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Readme", + "name" : "@Filter/Readme", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::RunExtraTests", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/RunExtraTests", + "version" : "0.029" + }, + { + "class" : "Dist::Zilla::Plugin::ShareDir", + "name" : "@Filter/ShareDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MakeMaker", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/MakeMaker", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", + "name" : "@Filter/CheckChangesHasContent", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::ConfirmRelease", + "name" : "@Filter/ConfirmRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Manifest", + "name" : "@Filter/Manifest", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaConfig", + "name" : "@Filter/MetaConfig", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaJSON", + "name" : "@Filter/MetaJSON", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Package", + "config" : { + "Dist::Zilla::Plugin::MetaProvides::Package" : { + "finder_objects" : [ + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "include_underscores" : 0 + }, + "Dist::Zilla::Role::MetaProvider::Provider" : { + "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", + "inherit_missing" : 1, + "inherit_version" : 1, + "meta_noindex" : 1 + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000033", + "version" : "0.006" + } + }, + "name" : "@Filter/MetaProvides::Package", + "version" : "2.004003" + }, + { + "class" : "Dist::Zilla::Plugin::MetaResources", + "name" : "@Filter/MetaResources", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ModuleBuild", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/ModuleBuild", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PkgVersion", + "name" : "@Filter/PkgVersion", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodCoverageTests", + "name" : "@Filter/PodCoverageTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodSyntaxTests", + "name" : "@Filter/PodSyntaxTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodVersion", + "name" : "@Filter/PodVersion", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Compile", + "config" : { + "Dist::Zilla::Plugin::Test::Compile" : { + "bail_out_on_fail" : 0, + "fail_on_warning" : "author", + "fake_home" : 0, + "filename" : "t/00-compile.t", + "module_finder" : [ + ":InstallModules" + ], + "needs_display" : 0, + "phase" : "test", + "script_finder" : [ + ":PerlExecFiles" + ], + "skips" : [], + "switch" : [] + } + }, + "name" : "@Filter/Test::Compile", + "version" : "2.058" + }, + { + "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", + "config" : { + "Dist::Zilla::Plugin::Test::CPAN::Changes" : { + "changelog" : "Changes" + } + }, + "name" : "@Filter/Test::CPAN::Changes", + "version" : "0.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::EOL", + "config" : { + "Dist::Zilla::Plugin::Test::EOL" : { + "filename" : "xt/author/eol.t", + "finder" : [ + ":ExecFiles", + ":InstallModules", + ":TestFiles" + ], + "trailing_whitespace" : 1 + } + }, + "name" : "@Filter/Test::EOL", + "version" : "0.19" + }, + { + "class" : "Dist::Zilla::Plugin::Test::NoTabs", + "config" : { + "Dist::Zilla::Plugin::Test::NoTabs" : { + "filename" : "xt/author/no-tabs.t", + "finder" : [ + ":InstallModules", + ":ExecFiles", + ":TestFiles" + ] + } + }, + "name" : "@Filter/Test::NoTabs", + "version" : "0.15" + }, + { + "class" : "Dist::Zilla::Plugin::Test::TrailingSpace", + "name" : "@Filter/Test::TrailingSpace", + "version" : "0.2.0" + }, + { + "class" : "Dist::Zilla::Plugin::TestRelease", + "name" : "@Filter/TestRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodWeaver", + "config" : { + "Dist::Zilla::Plugin::PodWeaver" : { + "finder" : [ + ":InstallModules", + ":ExecFiles" + ], + "plugins" : [ + { + "class" : "Pod::Weaver::Plugin::EnsurePod5", + "name" : "@CorePrep/EnsurePod5", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Plugin::H1Nester", + "name" : "@CorePrep/H1Nester", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "NAME", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Version", + "name" : "Version", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "prelude", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "SYNOPSIS", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "DESCRIPTION", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "OVERVIEW", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "ATTRIBUTES", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "METHODS", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Leftovers", + "name" : "Leftovers", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "postlude", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Authors", + "name" : "Authors", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Legal", + "name" : "Legal", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Bugs", + "name" : "Bugs", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Support", + "name" : "Support", + "version" : "1.010" + } + ] + } + }, + "name" : "@Filter/PodWeaver", + "version" : "4.008" + }, + { + "class" : "Dist::Zilla::Plugin::UploadToCPAN", + "name" : "@Filter/UploadToCPAN", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":IncModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":TestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExtraTestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":PerlExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ShareFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":MainModule", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":AllFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":NoFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "zilla" : { + "class" : "Dist::Zilla::Dist::Builder", + "config" : { + "is_trial" : 0 + }, + "version" : "6.012" + } + }, + "x_generated_by_perl" : "v5.28.0", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.06" +} + @@ -6,21 +6,25 @@ build_requires: File::Copy: '0' File::Spec: '3.29' File::Spec::Functions: '0' - File::Temp: '0' IO::Handle: '0' IPC::Open3: '0' - Test::More: '0' - blib: '1.01' + Module::Build: '0.28' + Test::More: '0.88' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' + Module::Build: '0.28' dynamic_config: 0 -generated_by: 'Dist::Zilla version 5.046, CPAN::Meta::Converter version 2.150001' +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: File-Remove +provides: + File::Remove: + file: lib/File/Remove.pm + version: '1.58' requires: Cwd: '3.29' File::Glob: '0' @@ -33,5 +37,325 @@ requires: warnings: '0' resources: bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove + homepage: http://metacpan.org/release/File-Remove repository: git://github.com/shlomif/File-Remove.git -version: '1.57' +version: '1.58' +x_Dist_Zilla: + perl: + version: '5.028000' + plugins: + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: test + type: requires + name: '@Filter/TestMoreDoneTesting' + version: '6.012' + - + class: Dist::Zilla::Plugin::AutoPrereqs + name: '@Filter/AutoPrereqs' + version: '6.012' + - + class: Dist::Zilla::Plugin::ExecDir + name: '@Filter/ExecDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::GatherDir + config: + Dist::Zilla::Plugin::GatherDir: + exclude_filename: [] + exclude_match: [] + follow_symlinks: 0 + include_dotfiles: 0 + prefix: '' + prune_directory: [] + root: . + name: '@Filter/GatherDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::ManifestSkip + name: '@Filter/ManifestSkip' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaYAML + name: '@Filter/MetaYAML' + version: '6.012' + - + class: Dist::Zilla::Plugin::PruneCruft + name: '@Filter/PruneCruft' + version: '6.012' + - + class: Dist::Zilla::Plugin::Readme + name: '@Filter/Readme' + version: '6.012' + - + class: Dist::Zilla::Plugin::RunExtraTests + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/RunExtraTests' + version: '0.029' + - + class: Dist::Zilla::Plugin::ShareDir + name: '@Filter/ShareDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::MakeMaker + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/MakeMaker' + version: '6.012' + - + class: Dist::Zilla::Plugin::CheckChangesHasContent + name: '@Filter/CheckChangesHasContent' + version: '0.011' + - + class: Dist::Zilla::Plugin::ConfirmRelease + name: '@Filter/ConfirmRelease' + version: '6.012' + - + class: Dist::Zilla::Plugin::Manifest + name: '@Filter/Manifest' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaConfig + name: '@Filter/MetaConfig' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaJSON + name: '@Filter/MetaJSON' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaProvides::Package + config: + Dist::Zilla::Plugin::MetaProvides::Package: + finder_objects: + - + class: Dist::Zilla::Plugin::FinderCode + name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '6.012' + include_underscores: 0 + Dist::Zilla::Role::MetaProvider::Provider: + $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' + inherit_missing: '1' + inherit_version: '1' + meta_noindex: '1' + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000033' + version: '0.006' + name: '@Filter/MetaProvides::Package' + version: '2.004003' + - + class: Dist::Zilla::Plugin::MetaResources + name: '@Filter/MetaResources' + version: '6.012' + - + class: Dist::Zilla::Plugin::ModuleBuild + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/ModuleBuild' + version: '6.012' + - + class: Dist::Zilla::Plugin::PkgVersion + name: '@Filter/PkgVersion' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodCoverageTests + name: '@Filter/PodCoverageTests' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodSyntaxTests + name: '@Filter/PodSyntaxTests' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodVersion + name: '@Filter/PodVersion' + version: '6.012' + - + class: Dist::Zilla::Plugin::Test::Compile + config: + Dist::Zilla::Plugin::Test::Compile: + bail_out_on_fail: '0' + fail_on_warning: author + fake_home: 0 + filename: t/00-compile.t + module_finder: + - ':InstallModules' + needs_display: 0 + phase: test + script_finder: + - ':PerlExecFiles' + skips: [] + switch: [] + name: '@Filter/Test::Compile' + version: '2.058' + - + class: Dist::Zilla::Plugin::Test::CPAN::Changes + config: + Dist::Zilla::Plugin::Test::CPAN::Changes: + changelog: Changes + name: '@Filter/Test::CPAN::Changes' + version: '0.012' + - + class: Dist::Zilla::Plugin::Test::EOL + config: + Dist::Zilla::Plugin::Test::EOL: + filename: xt/author/eol.t + finder: + - ':ExecFiles' + - ':InstallModules' + - ':TestFiles' + trailing_whitespace: 1 + name: '@Filter/Test::EOL' + version: '0.19' + - + class: Dist::Zilla::Plugin::Test::NoTabs + config: + Dist::Zilla::Plugin::Test::NoTabs: + filename: xt/author/no-tabs.t + finder: + - ':InstallModules' + - ':ExecFiles' + - ':TestFiles' + name: '@Filter/Test::NoTabs' + version: '0.15' + - + class: Dist::Zilla::Plugin::Test::TrailingSpace + name: '@Filter/Test::TrailingSpace' + version: 0.2.0 + - + class: Dist::Zilla::Plugin::TestRelease + name: '@Filter/TestRelease' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodWeaver + config: + Dist::Zilla::Plugin::PodWeaver: + finder: + - ':InstallModules' + - ':ExecFiles' + plugins: + - + class: Pod::Weaver::Plugin::EnsurePod5 + name: '@CorePrep/EnsurePod5' + version: '4.015' + - + class: Pod::Weaver::Plugin::H1Nester + name: '@CorePrep/H1Nester' + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: NAME + version: '4.015' + - + class: Pod::Weaver::Section::Version + name: Version + version: '4.015' + - + class: Pod::Weaver::Section::Region + name: prelude + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: SYNOPSIS + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: DESCRIPTION + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: OVERVIEW + version: '4.015' + - + class: Pod::Weaver::Section::Collect + name: ATTRIBUTES + version: '4.015' + - + class: Pod::Weaver::Section::Collect + name: METHODS + version: '4.015' + - + class: Pod::Weaver::Section::Leftovers + name: Leftovers + version: '4.015' + - + class: Pod::Weaver::Section::Region + name: postlude + version: '4.015' + - + class: Pod::Weaver::Section::Authors + name: Authors + version: '4.015' + - + class: Pod::Weaver::Section::Legal + name: Legal + version: '4.015' + - + class: Pod::Weaver::Section::Bugs + name: Bugs + version: '4.015' + - + class: Pod::Weaver::Section::Support + name: Support + version: '1.010' + name: '@Filter/PodWeaver' + version: '4.008' + - + class: Dist::Zilla::Plugin::UploadToCPAN + name: '@Filter/UploadToCPAN' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':IncModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':TestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExtraTestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':PerlExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ShareFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':MainModule' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':AllFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':NoFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '6.012' + zilla: + class: Dist::Zilla::Dist::Builder + config: + is_trial: '0' + version: '6.012' +x_generated_by_perl: v5.28.0 +x_serialization_backend: 'YAML::Tiny version 1.73' diff --git a/Makefile.PL b/Makefile.PL index 3cc656e..692733b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.046. +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; @@ -9,8 +9,12 @@ use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Remove files and directories", "AUTHOR" => "Shlomi Fish <shlomif\@cpan.org>", + "BUILD_REQUIRES" => { + "Module::Build" => "0.28" + }, "CONFIGURE_REQUIRES" => { - "ExtUtils::MakeMaker" => 0 + "ExtUtils::MakeMaker" => 0, + "Module::Build" => "0.28" }, "DISTNAME" => "File-Remove", "LICENSE" => "perl", @@ -30,13 +34,11 @@ my %WriteMakefileArgs = ( "File::Copy" => 0, "File::Spec" => "3.29", "File::Spec::Functions" => 0, - "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, - "Test::More" => 0, - "blib" => "1.01" + "Test::More" => "0.88" }, - "VERSION" => "1.57", + "VERSION" => "1.58", "test" => { "TESTS" => "t/*.t" } @@ -50,11 +52,10 @@ my %FallbackPrereqs = ( "File::Path" => 0, "File::Spec" => "3.29", "File::Spec::Functions" => 0, - "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, - "Test::More" => 0, - "blib" => "1.01", + "Module::Build" => "0.28", + "Test::More" => "0.88", "constant" => 0, "strict" => 0, "vars" => 0, @@ -1,7 +1,5 @@ - - This archive contains the distribution File-Remove, -version 1.57: +version 1.58: Remove files and directories @@ -11,5 +9,4 @@ This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. -This README file was generated by Dist::Zilla::Plugin::Readme v5.046. - +This README file was generated by Dist::Zilla::Plugin::Readme v6.012. @@ -1,26 +1,16 @@ -name = File-Remove -author = Shlomi Fish <shlomif@cpan.org> +name = File-Remove +author = Shlomi Fish <shlomif@cpan.org> license = Perl_5 copyright_holder = Gabor Egressy -copyright_year = 1998 +copyright_year = 1998 +version = 1.58 [@Filter] --bundle = @Basic +-bundle = @SHLOMIF -remove = License -[AutoPrereqs] -[PodSyntaxTests] -[PodCoverageTests] -[MetaResources] -bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove -bugtracker.mailto = bug-file-remove@rt.cpan.org -repository.url = git://github.com/shlomif/File-Remove.git -repository.web = https://github.com/shlomif/File-Remove -repository.type = git -[PodWeaver] -[Test::Compile] -fake_home = 1 -skip = bump-ver -[Test::CPAN::Changes] -[Test::Kwalitee::Extra] -[Test::TrailingSpace] -[VersionFromModule] +dist = File-Remove +bugtracker_web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove +bugtracker_mailto = bug-file-remove@rt.cpan.org +repository_url = git://github.com/shlomif/File-Remove.git +repository_web = https://github.com/shlomif/File-Remove +repository_type = git diff --git a/lib/File/Remove.pm b/lib/File/Remove.pm index 08b6299..8c32c7c 100644 --- a/lib/File/Remove.pm +++ b/lib/File/Remove.pm @@ -4,13 +4,15 @@ use 5.00503; use strict; use warnings; -use vars qw{ $VERSION @ISA @EXPORT_OK }; +use vars qw{ @ISA @EXPORT_OK }; use vars qw{ $DEBUG $unlink $rmdir }; + +our $VERSION = '1.58'; + BEGIN { - $VERSION = '1.57'; - # $VERSION = eval $VERSION; - @ISA = qw{ Exporter }; - @EXPORT_OK = qw{ remove rm clear trash }; + # $VERSION = eval $VERSION; + @ISA = qw{ Exporter }; + @EXPORT_OK = qw{ remove rm clear trash }; } use File::Path (); @@ -47,175 +49,175 @@ my $glue; my @CLEANUP = (); sub clear (@) { - my @files = expand( @_ ); - - # Do the initial deletion - foreach my $file ( @files ) { - next unless -e $file; - remove( \1, $file ); - } - - # Delete again at END-time. - # Save the current PID so that forked children - # won't delete things that the parent expects to - # live until their end-time. - push @CLEANUP, map { [ $$, $_ ] } @files; + my @files = expand( @_ ); + + # Do the initial deletion + foreach my $file ( @files ) { + next unless -e $file; + remove( \1, $file ); + } + + # Delete again at END-time. + # Save the current PID so that forked children + # won't delete things that the parent expects to + # live until their end-time. + push @CLEANUP, map { [ $$, $_ ] } @files; } END { - foreach my $file ( @CLEANUP ) { - next unless $file->[0] == $$; - next unless -e $file->[1]; - remove( \1, $file->[1] ); - } + foreach my $file ( @CLEANUP ) { + next unless $file->[0] == $$; + next unless -e $file->[1]; + remove( \1, $file->[1] ); + } } # Acts like unlink would until given a directory as an argument, then # it acts like rm -rf ;) unless the recursive arg is zero which it is by # default sub remove (@) { - my $recursive = (ref $_[0] eq 'SCALAR') ? shift : \0; + my $recursive = (ref $_[0] eq 'SCALAR') ? shift : \0; my $opts = (ref $_[0] eq 'HASH') ? shift : { glob => 1 }; - my @files = _expand_with_opts ($opts, @_); - - # Iterate over the files - my @removes; - foreach my $path ( @files ) { - # need to check for symlink first - # could be pointing to nonexisting/non-readable destination - if ( -l $path ) { - print "link: $path\n" if DEBUG; - if ( $unlink ? $unlink->($path) : unlink($path) ) { - push @removes, $path; - } - next; - } - unless ( -e $path ) { - print "missing: $path\n" if DEBUG; - push @removes, $path; # Say we deleted it - next; - } - my $can_delete; - if ( IS_VMS ) { - $can_delete = VMS::Filespec::candelete($path); - } elsif ( IS_WIN32 ) { - # Assume we can delete it for the moment - $can_delete = 1; - } elsif ( -w $path ) { - # We have write permissions already - $can_delete = 1; - } elsif ( $< == 0 ) { - # Unixy and root - $can_delete = 1; - } elsif ( (lstat($path))[4] == $< ) { - # I own the file - $can_delete = 1; - } else { - # I don't think we can delete it - $can_delete = 0; - } - unless ( $can_delete ) { - print "nowrite: $path\n" if DEBUG; - next; - } - - if ( -f $path ) { - print "file: $path\n" if DEBUG; - unless ( -w $path ) { - # Make the file writable (implementation from File::Path) - (undef, undef, my $rp) = lstat $path or next; - $rp &= 07777; # Don't forget setuid, setgid, sticky bits - $rp |= 0600; # Turn on user read/write - chmod $rp, $path; - } - if ( $unlink ? $unlink->($path) : unlink($path) ) { - # Failed to delete the file - next if -e $path; - push @removes, $path; - } - - } elsif ( -d $path ) { - print "dir: $path\n" if DEBUG; - my $dir = File::Spec->canonpath($path); - - # Do we need to move our cwd out of the location - # we are planning to delete? - my $chdir = _moveto($dir); - if ( length $chdir ) { - chdir($chdir) or next; - } - - if ( $$recursive ) { - if ( File::Path::rmtree( [ $dir ], DEBUG, 0 ) ) { - # Failed to delete the directory - next if -e $path; - push @removes, $path; - } - - } else { - my ($save_mode) = (stat $dir)[2]; - chmod $save_mode & 0777, $dir; # just in case we cannot remove it. - if ( $rmdir ? $rmdir->($dir) : rmdir($dir) ) { - # Failed to delete the directory - next if -e $path; - push @removes, $path; - } - } - - } else { - print "???: $path\n" if DEBUG; - } - } - - return @removes; + my @files = _expand_with_opts ($opts, @_); + + # Iterate over the files + my @removes; + foreach my $path ( @files ) { + # need to check for symlink first + # could be pointing to nonexisting/non-readable destination + if ( -l $path ) { + print "link: $path\n" if DEBUG; + if ( $unlink ? $unlink->($path) : unlink($path) ) { + push @removes, $path; + } + next; + } + unless ( -e $path ) { + print "missing: $path\n" if DEBUG; + push @removes, $path; # Say we deleted it + next; + } + my $can_delete; + if ( IS_VMS ) { + $can_delete = VMS::Filespec::candelete($path); + } elsif ( IS_WIN32 ) { + # Assume we can delete it for the moment + $can_delete = 1; + } elsif ( -w $path ) { + # We have write permissions already + $can_delete = 1; + } elsif ( $< == 0 ) { + # Unixy and root + $can_delete = 1; + } elsif ( (lstat($path))[4] == $< ) { + # I own the file + $can_delete = 1; + } else { + # I don't think we can delete it + $can_delete = 0; + } + unless ( $can_delete ) { + print "nowrite: $path\n" if DEBUG; + next; + } + + if ( -f $path ) { + print "file: $path\n" if DEBUG; + unless ( -w $path ) { + # Make the file writable (implementation from File::Path) + (undef, undef, my $rp) = lstat $path or next; + $rp &= 07777; # Don't forget setuid, setgid, sticky bits + $rp |= 0600; # Turn on user read/write + chmod $rp, $path; + } + if ( $unlink ? $unlink->($path) : unlink($path) ) { + # Failed to delete the file + next if -e $path; + push @removes, $path; + } + + } elsif ( -d $path ) { + print "dir: $path\n" if DEBUG; + my $dir = File::Spec->canonpath($path); + + # Do we need to move our cwd out of the location + # we are planning to delete? + my $chdir = _moveto($dir); + if ( length $chdir ) { + chdir($chdir) or next; + } + + if ( $$recursive ) { + if ( File::Path::rmtree( [ $dir ], DEBUG, 0 ) ) { + # Failed to delete the directory + next if -e $path; + push @removes, $path; + } + + } else { + my ($save_mode) = (stat $dir)[2]; + chmod $save_mode & 0777, $dir; # just in case we cannot remove it. + if ( $rmdir ? $rmdir->($dir) : rmdir($dir) ) { + # Failed to delete the directory + next if -e $path; + push @removes, $path; + } + } + + } else { + print "???: $path\n" if DEBUG; + } + } + + return @removes; } sub rm (@) { - goto &remove; + goto &remove; } sub trash (@) { - local $unlink = $unlink; - local $rmdir = $rmdir; - - if ( ref $_[0] eq 'HASH' ) { - my %options = %{+shift @_}; - $unlink = $options{unlink}; - $rmdir = $options{rmdir}; - - } elsif ( IS_WIN32 ) { - local $@; - eval 'use Win32::FileOp ();'; - die "Can't load Win32::FileOp to support the Recycle Bin: \$@ = $@" if length $@; - $unlink = \&Win32::FileOp::Recycle; - $rmdir = \&Win32::FileOp::Recycle; - - } elsif ( IS_MAC ) { - unless ( $glue ) { - local $@; - eval 'use Mac::Glue ();'; - die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@; - $glue = Mac::Glue->new('Finder'); - } - my $code = sub { - my @files = map { - Mac::Glue::param_type( - Mac::Glue::typeAlias() => $_ - ) - } @_; - $glue->delete(\@files); - }; - $unlink = $code; - $rmdir = $code; - } else { - die "Support for trash() on platform '$^O' not available at this time.\n"; - } - - remove(@_); + local $unlink = $unlink; + local $rmdir = $rmdir; + + if ( ref $_[0] eq 'HASH' ) { + my %options = %{+shift @_}; + $unlink = $options{unlink}; + $rmdir = $options{rmdir}; + + } elsif ( IS_WIN32 ) { + local $@; + eval 'use Win32::FileOp ();'; + die "Can't load Win32::FileOp to support the Recycle Bin: \$@ = $@" if length $@; + $unlink = \&Win32::FileOp::Recycle; + $rmdir = \&Win32::FileOp::Recycle; + + } elsif ( IS_MAC ) { + unless ( $glue ) { + local $@; + eval 'use Mac::Glue ();'; + die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@; + $glue = Mac::Glue->new('Finder'); + } + my $code = sub { + my @files = map { + Mac::Glue::param_type( + Mac::Glue::typeAlias() => $_ + ) + } @_; + $glue->delete(\@files); + }; + $unlink = $code; + $rmdir = $code; + } else { + die "Support for trash() on platform '$^O' not available at this time.\n"; + } + + remove(@_); } sub undelete (@) { - goto &trash; + goto &trash; } @@ -231,43 +233,43 @@ sub _expand_with_opts { } sub expand (@) { - map { -e $_ ? $_ : File::Glob::bsd_glob($_) } @_; + map { -e $_ ? $_ : File::Glob::bsd_glob($_) } @_; } # Do we need to move to a different directory to delete a directory, # and if so which. sub _moveto { - my $remove = File::Spec->rel2abs(shift); - my $cwd = @_ ? shift : Cwd::cwd(); - - # Do everything in absolute terms - $remove = Cwd::abs_path( $remove ); - $cwd = Cwd::abs_path( $cwd ); - - # If we are on a different volume we don't need to move - my ( $cv, $cd ) = File::Spec->splitpath( $cwd, 1 ); - my ( $rv, $rd ) = File::Spec->splitpath( $remove, 1 ); - return '' unless $cv eq $rv; - - # If we have to move, it's to one level above the deletion - my @cd = File::Spec->splitdir($cd); - my @rd = File::Spec->splitdir($rd); - - # Is the current directory the same as or inside the remove directory? - unless ( @cd >= @rd ) { - return ''; - } - foreach ( 0 .. $#rd ) { - $cd[$_] eq $rd[$_] or return ''; - } - - # Confirmed, the current working dir is in the removal dir - pop @rd; - return File::Spec->catpath( - $rv, - File::Spec->catdir(@rd), - '' - ); + my $remove = File::Spec->rel2abs(shift); + my $cwd = @_ ? shift : Cwd::cwd(); + + # Do everything in absolute terms + $remove = Cwd::abs_path( $remove ); + $cwd = Cwd::abs_path( $cwd ); + + # If we are on a different volume we don't need to move + my ( $cv, $cd ) = File::Spec->splitpath( $cwd, 1 ); + my ( $rv, $rd ) = File::Spec->splitpath( $remove, 1 ); + return '' unless $cv eq $rv; + + # If we have to move, it's to one level above the deletion + my @cd = File::Spec->splitdir($cd); + my @rd = File::Spec->splitdir($rd); + + # Is the current directory the same as or inside the remove directory? + unless ( @cd >= @rd ) { + return ''; + } + foreach ( 0 .. $#rd ) { + $cd[$_] eq $rd[$_] or return ''; + } + + # Confirmed, the current working dir is in the removal dir + pop @rd; + return File::Spec->catpath( + $rv, + File::Spec->catdir(@rd), + '' + ); } 1; @@ -282,7 +284,7 @@ File::Remove - Remove files and directories =head1 VERSION -version 1.57 +version 1.58 =head1 SYNOPSIS @@ -314,6 +316,10 @@ B<File::Remove::trash> accepts the same arguments as B<remove>, with the addition of an optional, infrequently used "other platforms" hashref. +=head1 VERSION + +version 1.58 + =head1 SUBROUTINES =head2 remove @@ -432,8 +438,8 @@ the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website -http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove or by email to -bug-file-remove@rt.cpan.org. +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove> or by email to +L<bug-file-remove@rt.cpan.org|mailto:bug-file-remove@rt.cpan.org>. When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired @@ -462,7 +468,7 @@ MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. -L<http://metacpan.org/release/File-Remove> +L<https://metacpan.org/release/File-Remove> =item * @@ -498,14 +504,6 @@ L<http://cpanratings.perl.org/d/File-Remove> =item * -CPAN Forum - -The CPAN Forum is a web forum for discussing Perl modules. - -L<http://cpanforum.com/dist/File-Remove> - -=item * - CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. @@ -516,7 +514,7 @@ L<http://cpants.cpanauthors.org/dist/File-Remove> CPAN Testers -The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. +The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L<http://www.cpantesters.org/distro/F/File-Remove> diff --git a/t/00-compile.t b/t/00-compile.t index 1318995..d7ed93c 100644 --- a/t/00-compile.t +++ b/t/00-compile.t @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; -# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; @@ -14,12 +14,11 @@ my @module_files = ( -# fake home for cpan-testers -use File::Temp; -local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); +# no fake home requested - -my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; +my @switches = ( + -d 'blib' ? '-Mblib' : '-Ilib', +); use File::Spec; use IPC::Open3; @@ -33,14 +32,18 @@ for my $lib (@module_files) # see L<perlfaq8/How can I capture STDERR from an external command?> my $stderr = IO::Handle->new; - my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } + $^X, @switches, '-e', "require q[$lib]")) + if $ENV{PERL_COMPILE_TEST_DEBUG}; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ - and not eval { require blib; blib->VERSION('1.01') }; + and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { diff --git a/t/01_compile.t b/t/01_compile.t index a78ae08..72674e3 100755 --- a/t/01_compile.t +++ b/t/01_compile.t @@ -4,8 +4,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 1; diff --git a/t/02_directories.t b/t/02_directories.t index 7d0a1a4..dc5edee 100755 --- a/t/02_directories.t +++ b/t/02_directories.t @@ -2,8 +2,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More 'no_plan'; @@ -17,133 +17,133 @@ use File::Remove qw{ remove trash }; my @dirs = ("$0.tmp", map { "$0.tmp/$_" } qw(a a/b c c/d e e/f g)); for my $path ( reverse @dirs ) { - if ( -e $path ) { - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); - } + if ( -e $path ) { + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); + } } for my $path ( @dirs ) { - ok( ! -e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); + ok( ! -e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); } for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); + ok( -e $path, "-e: $path" ); + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); } for my $path ( @dirs ) { - ok( ! -e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); + ok( ! -e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); } for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( remove(\1, $path), "remove \\1: $path" ); - ok( !-e $path, "!-e: $path" ); + ok( -e $path, "-e: $path" ); + ok( remove(\1, $path), "remove \\1: $path" ); + ok( !-e $path, "!-e: $path" ); } for my $path (@dirs) { - ok( !-e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); + ok( !-e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); } for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( remove($path), "remove: $path" ); - ok( !-e $path, "!-e: $path" ); + ok( -e $path, "-e: $path" ); + ok( remove($path), "remove: $path" ); + ok( !-e $path, "!-e: $path" ); } for my $path (reverse @dirs) { - ok( !-e $path, "-e: $path" ); - if (-e _) { - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); - } + ok( !-e $path, "-e: $path" ); + if (-e _) { + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); + } } SKIP: { - if ($^O eq 'darwin') { - eval 'use Mac::Glue ();'; - skip "Undelete support requires Mac::Glue", 0 if length $@; - eval 'Mac::Glue->new("Finder")'; - skip "Undelete support requires Mac::Glue with Finder support", 0 if length $@; - } elsif ($^O eq 'cygwin' || $^O =~ /^MSWin/) { - eval 'use Win32::FileOp::Recycle;'; - skip "Undelete support requires Win32::FileOp::Recycle", 0 if length $@; - } else { - skip "Undelete support not available by default", 0; - } - - for my $path (@dirs) { - ok( !-e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); - } - - for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( eval { trash($path) }, "trash: $path" ); - is( $@, '', "trash: \$@" ); - ok( !-e $path, "!-e: $path" ); - } - - for my $path (reverse @dirs) { - ok( !-e $path, "-e: $path" ); - if (-e _) { - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); - } - } - - for my $path (@dirs) { - ok( !-e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); - } - - for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( remove($path), "remove: $path" ); - ok( !-e $path, "!-e: $path" ); - } - - for my $path (reverse @dirs) { - ok( !-e $path, "-e: $path" ); - if (-e _) { - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); - } - } - - for my $path (@dirs) { - ok( !-e $path, "!-e: $path" ); - ok( mkdir($path, 0777), "mkdir: $path" ); - chmod 0777, $path; - ok( -e $path, "-e: $path" ); - } - - for my $path (reverse @dirs) { - ok( -e $path, "-e: $path" ); - ok( - # Fake callbacks will not remove directories, so trash() would return empty list - eval { trash({ 'rmdir' => sub { 1 }, 'unlink' => sub { 1 } }, $path); 1 }, - "trash: $path", - ); - ok( -e $path, "-e: $path" ); - ok( rmdir($path), "rmdir: $path" ); - ok( !-e $path, "!-e: $path" ); - } - - UNDELETE: 1; + if ($^O eq 'darwin') { + eval 'use Mac::Glue ();'; + skip "Undelete support requires Mac::Glue", 0 if length $@; + eval 'Mac::Glue->new("Finder")'; + skip "Undelete support requires Mac::Glue with Finder support", 0 if length $@; + } elsif ($^O eq 'cygwin' || $^O =~ /^MSWin/) { + eval 'use Win32::FileOp::Recycle;'; + skip "Undelete support requires Win32::FileOp::Recycle", 0 if length $@; + } else { + skip "Undelete support not available by default", 0; + } + + for my $path (@dirs) { + ok( !-e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); + } + + for my $path (reverse @dirs) { + ok( -e $path, "-e: $path" ); + ok( eval { trash($path) }, "trash: $path" ); + is( $@, '', "trash: \$@" ); + ok( !-e $path, "!-e: $path" ); + } + + for my $path (reverse @dirs) { + ok( !-e $path, "-e: $path" ); + if (-e _) { + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); + } + } + + for my $path (@dirs) { + ok( !-e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); + } + + for my $path (reverse @dirs) { + ok( -e $path, "-e: $path" ); + ok( remove($path), "remove: $path" ); + ok( !-e $path, "!-e: $path" ); + } + + for my $path (reverse @dirs) { + ok( !-e $path, "-e: $path" ); + if (-e _) { + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); + } + } + + for my $path (@dirs) { + ok( !-e $path, "!-e: $path" ); + ok( mkdir($path, 0777), "mkdir: $path" ); + chmod 0777, $path; + ok( -e $path, "-e: $path" ); + } + + for my $path (reverse @dirs) { + ok( -e $path, "-e: $path" ); + ok( + # Fake callbacks will not remove directories, so trash() would return empty list + eval { trash({ 'rmdir' => sub { 1 }, 'unlink' => sub { 1 } }, $path); 1 }, + "trash: $path", + ); + ok( -e $path, "-e: $path" ); + ok( rmdir($path), "rmdir: $path" ); + ok( !-e $path, "!-e: $path" ); + } + + UNDELETE: 1; } diff --git a/t/03_deep_readonly.t b/t/03_deep_readonly.t index 11927ef..a88c2db 100755 --- a/t/03_deep_readonly.t +++ b/t/03_deep_readonly.t @@ -4,8 +4,8 @@ # deeply contains a readonly file that is owned by the current user. use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 12; @@ -27,44 +27,44 @@ my $d2 = catdir( $d1, 'd2' ); my $f3 = catfile( $d2, 'f3.txt' ); sub create_directory { - mkdir($d1,0777) or die "Failed to create $d1"; - ok( -d $d1, "Created $d1 ok" ); - ok( -r $d1, "Created $d1 -r" ); - ok( -w $d1, "Created $d1 -w" ); - mkdir($d2,0777) or die "Failed to create $d2"; - ok( -d $d2, "Created $d2 ok" ); - ok( -r $d2, "Created $d2 -r" ); - ok( -w $d2, "Created $d2 -w" ); - # Copy in a known-readonly file (in this case, the File::Spec lib we are using - File::Copy::copy( $INC{'File/Spec.pm'} => $f3 ); - chmod( 0400, $f3 ); - ok( -f $f3, "Created $f3 ok" ); - ok( -r $f3, "Created $f3 -r" ); - SKIP: { - if ( $^O ne 'MSWin32' and ($< == 0 or $> == 0) ) { - skip("This test doesn't work as root", 1); - } - if ( $^O eq 'cygwin' ) { - skip("Fails on some cygwin and shouldn't prevent install",1); - } - ok( ! -w $f3, "Created $f3 ! -w" ); - }; + mkdir($d1,0777) or die "Failed to create $d1"; + ok( -d $d1, "Created $d1 ok" ); + ok( -r $d1, "Created $d1 -r" ); + ok( -w $d1, "Created $d1 -w" ); + mkdir($d2,0777) or die "Failed to create $d2"; + ok( -d $d2, "Created $d2 ok" ); + ok( -r $d2, "Created $d2 -r" ); + ok( -w $d2, "Created $d2 -w" ); + # Copy in a known-readonly file (in this case, the File::Spec lib we are using + File::Copy::copy( $INC{'File/Spec.pm'} => $f3 ); + chmod( 0400, $f3 ); + ok( -f $f3, "Created $f3 ok" ); + ok( -r $f3, "Created $f3 -r" ); + SKIP: { + if ( $^O ne 'MSWin32' and ($< == 0 or $> == 0) ) { + skip("This test doesn't work as root", 1); + } + if ( $^O eq 'cygwin' ) { + skip("Fails on some cygwin and shouldn't prevent install",1); + } + ok( ! -w $f3, "Created $f3 ! -w" ); + }; } sub clear_directory { - if ( -e $f3 ) { - chmod( 0700, $f3 ) or die "chmod 0700 $f3 failed"; - unlink( $f3 ) or die "unlink: $f3 failed"; - ! -e $f3 or die "unlink didn't work"; - } - if ( -e $d2 ) { - rmdir( $d2 ) or die "rmdir: $d2 failed"; - ! -e $d2 or die "rmdir didn't work"; - } - if ( -e $d1 ) { - rmdir( $d1 ) or die "rmdir: $d1 failed"; - ! -e $d1 or die "rmdir didn't work"; - } + if ( -e $f3 ) { + chmod( 0700, $f3 ) or die "chmod 0700 $f3 failed"; + unlink( $f3 ) or die "unlink: $f3 failed"; + ! -e $f3 or die "unlink didn't work"; + } + if ( -e $d2 ) { + rmdir( $d2 ) or die "rmdir: $d2 failed"; + ! -e $d2 or die "rmdir didn't work"; + } + if ( -e $d1 ) { + rmdir( $d1 ) or die "rmdir: $d1 failed"; + ! -e $d1 or die "rmdir didn't work"; + } } # Make sure there is no directory from a previous run @@ -75,7 +75,7 @@ create_directory(); # Schedule cleanup END { - clear_directory(); + clear_directory(); } diff --git a/t/04_can_delete.t b/t/04_can_delete.t index 2533c09..5ed55a2 100644 --- a/t/04_can_delete.t +++ b/t/04_can_delete.t @@ -4,8 +4,8 @@ # deeply contains a readonly file that is owned by the current user. use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 12; @@ -28,44 +28,44 @@ my $d2 = catdir( $d1, 'd2' ); my $f3 = catfile( $d2, 'f3.txt' ); sub create_directory { - mkdir($d1,0777) or die "Failed to create $d1"; - ok( -d $d1, "Created $d1 ok" ); - ok( -r $d1, "Created $d1 -r" ); - ok( -w $d1, "Created $d1 -w" ); - mkdir($d2,0777) or die "Failed to create $d2"; - ok( -d $d2, "Created $d2 ok" ); - ok( -r $d2, "Created $d2 -r" ); - ok( -w $d2, "Created $d2 -w" ); - # Copy in a known-readonly file (in this case, the File::Spec lib we are using - File::Copy::copy( $INC{'File/Spec.pm'} => $f3 ); - chmod( 0400, $f3 ); - ok( -f $f3, "Created $f3 ok" ); - ok( -r $f3, "Created $f3 -r" ); - SKIP: { - if ( $^O ne 'MSWin32' and $< == 0 ) { - skip("This test doesn't work as root", 1); - } - if ( $^O eq 'cygwin' ) { - skip("Fails on some cygwin and shouldn't prevent install",1); - } - ok( ! -w $f3, "Created $f3 ! -w" ); - }; + mkdir($d1,0777) or die "Failed to create $d1"; + ok( -d $d1, "Created $d1 ok" ); + ok( -r $d1, "Created $d1 -r" ); + ok( -w $d1, "Created $d1 -w" ); + mkdir($d2,0777) or die "Failed to create $d2"; + ok( -d $d2, "Created $d2 ok" ); + ok( -r $d2, "Created $d2 -r" ); + ok( -w $d2, "Created $d2 -w" ); + # Copy in a known-readonly file (in this case, the File::Spec lib we are using + File::Copy::copy( $INC{'File/Spec.pm'} => $f3 ); + chmod( 0400, $f3 ); + ok( -f $f3, "Created $f3 ok" ); + ok( -r $f3, "Created $f3 -r" ); + SKIP: { + if ( $^O ne 'MSWin32' and $< == 0 ) { + skip("This test doesn't work as root", 1); + } + if ( $^O eq 'cygwin' ) { + skip("Fails on some cygwin and shouldn't prevent install",1); + } + ok( ! -w $f3, "Created $f3 ! -w" ); + }; } sub clear_directory { - if ( -e $f3 ) { - chmod( 0700, $f3 ) or die "chmod 0700 $f3 failed"; - unlink( $f3 ) or die "unlink: $f3 failed"; - ! -e $f3 or die "unlink didn't work"; - } - if ( -e $d2 ) { - rmdir( $d2 ) or die "rmdir: $d2 failed"; - ! -e $d2 or die "rmdir didn't work"; - } - if ( -e $d1 ) { - rmdir( $d1 ) or die "rmdir: $d1 failed"; - ! -e $d1 or die "rmdir didn't work"; - } + if ( -e $f3 ) { + chmod( 0700, $f3 ) or die "chmod 0700 $f3 failed"; + unlink( $f3 ) or die "unlink: $f3 failed"; + ! -e $f3 or die "unlink didn't work"; + } + if ( -e $d2 ) { + rmdir( $d2 ) or die "rmdir: $d2 failed"; + ! -e $d2 or die "rmdir didn't work"; + } + if ( -e $d1 ) { + rmdir( $d1 ) or die "rmdir: $d1 failed"; + ! -e $d1 or die "rmdir didn't work"; + } } # Make sure there is no directory from a previous run @@ -76,7 +76,7 @@ create_directory(); # Schedule cleanup END { - clear_directory(); + clear_directory(); } diff --git a/t/05_links.t b/t/05_links.t index 7f4a438..2be51dd 100644 --- a/t/05_links.t +++ b/t/05_links.t @@ -2,8 +2,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More; @@ -11,8 +11,8 @@ use File::Spec::Functions ':ALL'; use File::Remove (); unless( eval { symlink("",""); 1 } ) { - plan("skip_all" => "No Unix-like symlinks"); - exit(0); + plan("skip_all" => "No Unix-like symlinks"); + exit(0); } plan( tests => 8 ); @@ -20,29 +20,29 @@ plan( tests => 8 ); # Set up the tests my $testdir = catdir( 't', 'linktest' ); if ( -d $testdir ) { - File::Remove::remove( \1, $testdir ); - die "Failed to clear test directory '$testdir'" if -d $testdir; + File::Remove::remove( \1, $testdir ); + die "Failed to clear test directory '$testdir'" if -d $testdir; } ok( ! -d $testdir, 'Cleared testdir' ); unless( mkdir($testdir, 0777) ) { - die("Cannot create test directory '$testdir': $!"); + die("Cannot create test directory '$testdir': $!"); } ok( -d $testdir, 'Created testdir' ); my %links = ( - l_ex => curdir(), -# l_ex_a => rootdir(), - l_nex => 'does_not_exist' + l_ex => curdir(), +# l_ex_a => rootdir(), + l_nex => 'does_not_exist' ); my $errs = 0; foreach my $link (keys %links) { - my $path = catdir( $testdir, $link ); - unless( symlink($links{$link}, $path )) { - diag("Cannot create symlink $link -> $links{$link}: $!"); - $errs++; - } + my $path = catdir( $testdir, $link ); + unless( symlink($links{$link}, $path )) { + diag("Cannot create symlink $link -> $links{$link}: $!"); + $errs++; + } } if ( $errs ) { - die("Could not create test links"); + die("Could not create test links"); } ok( File::Remove::remove(\1, map { catdir($testdir, $_) } keys %links), "remove \\1: all links" ); @@ -51,9 +51,9 @@ my @entries; ok( opendir(DIR, $testdir) ); foreach my $dir ( readdir(DIR) ) { - next if $dir eq curdir(); - next if $dir eq updir(); - push @entries, $dir; + next if $dir eq curdir(); + next if $dir eq updir(); + push @entries, $dir; } ok( closedir(DIR) ); diff --git a/t/06_curly.t b/t/06_curly.t index 645ecfa..9c78d02 100644 --- a/t/06_curly.t +++ b/t/06_curly.t @@ -6,8 +6,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 6; @@ -18,7 +18,7 @@ use File::Remove (); my $dir = '{1234}'; my $path = catdir( 't', '{1234}' ); unless ( -e $path ) { - mkdir($path,0777); + mkdir($path,0777); } ok( -e $path, "Test directory $path exists" ); @@ -29,7 +29,7 @@ ok( ! -e $path, "remove deletes the $path directory" ); # Repeat the tests on a dir named {1234} in the root path unless ( -e $dir ) { - mkdir($dir,0777); + mkdir($dir,0777); } ok( -e $dir, "Test directory $dir exists" ); @removed = File::Remove::remove( \1, $dir ); @@ -2,8 +2,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 13; @@ -28,42 +28,42 @@ ok( -f $file, "$file file exists" ); # Test that _moveto behaves as expected SCOPE: { - is( - File::Remove::_moveto( - File::Spec->catdir($base, 't'), # remove - File::Spec->catdir($base), # cwd - ), - '', - '_moveto returns correct for normal case', - ); + is( + File::Remove::_moveto( + File::Spec->catdir($base, 't'), # remove + File::Spec->catdir($base), # cwd + ), + '', + '_moveto returns correct for normal case', + ); - my $moveto1 = File::Remove::_moveto( - File::Spec->catdir($base, 't'), # remove - File::Spec->catdir($base, 't'), # cwd - ); - $moveto1 =~ s/\\/\//g; - is( $moveto1, $base, '_moveto returns correct for normal case' ); + my $moveto1 = File::Remove::_moveto( + File::Spec->catdir($base, 't'), # remove + File::Spec->catdir($base, 't'), # cwd + ); + $moveto1 =~ s/\\/\//g; + is( $moveto1, $base, '_moveto returns correct for normal case' ); - my $moveto2 = File::Remove::_moveto( - File::Spec->catdir($base, 't'), # remove - File::Spec->catdir($base, 't', 'cwd'), # cwd - ); - $moveto2 =~ s/\\/\//g; - is( $moveto2, $base, '_moveto returns correct for normal case' ); + my $moveto2 = File::Remove::_moveto( + File::Spec->catdir($base, 't'), # remove + File::Spec->catdir($base, 't', 'cwd'), # cwd + ); + $moveto2 =~ s/\\/\//g; + is( $moveto2, $base, '_moveto returns correct for normal case' ); - # Regression: _moveto generates false positives - # cwd: /tmp/cpan2/PITA-Image/PITA-Image-0.50 - # remove: /tmp/eBtQxTPGHC - # moveto: /tmp - # expected: '' - is( - File::Remove::_moveto( - File::Spec->catdir($base, 't'), # remove - File::Spec->catdir($base, 'lib', 'File'), # cwd - ), - '', - '_moveto returns null as expected', - ); + # Regression: _moveto generates false positives + # cwd: /tmp/cpan2/PITA-Image/PITA-Image-0.50 + # remove: /tmp/eBtQxTPGHC + # moveto: /tmp + # expected: '' + is( + File::Remove::_moveto( + File::Spec->catdir($base, 't'), # remove + File::Spec->catdir($base, 'lib', 'File'), # cwd + ), + '', + '_moveto returns null as expected', + ); } # Change the current working directory into the first diff --git a/t/08_spaces.t b/t/08_spaces.t index 7e47232..8817811 100644 --- a/t/08_spaces.t +++ b/t/08_spaces.t @@ -5,8 +5,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More qw(no_plan); @@ -28,38 +28,38 @@ my $f2 = catfile( $s, 'foo2.txt' ); my $f3 = catfile( $s, 'bar.txt' ); sub create_directory { - mkdir($s,0777) or die "Failed to create $s"; - ok( -d $s, "Created $s ok" ); - ok( -r $s, "Created $s -r" ); - ok( -w $s, "Created $s -w" ); - open( FILE, ">$f1" ) or die "Failed to create $f1"; - print FILE "Test\n"; - close FILE; - open( FILE, ">$f2" ) or die "Failed to create $f2"; - print FILE "Test\n"; - close FILE; - open( FILE, ">$f3" ) or die "Failed to create $f3"; - print FILE "Test\n"; - close FILE; + mkdir($s,0777) or die "Failed to create $s"; + ok( -d $s, "Created $s ok" ); + ok( -r $s, "Created $s -r" ); + ok( -w $s, "Created $s -w" ); + open( FILE, ">$f1" ) or die "Failed to create $f1"; + print FILE "Test\n"; + close FILE; + open( FILE, ">$f2" ) or die "Failed to create $f2"; + print FILE "Test\n"; + close FILE; + open( FILE, ">$f3" ) or die "Failed to create $f3"; + print FILE "Test\n"; + close FILE; } sub clear_directory { - if ( -e $f1 ) { - unlink( $f1 ) or die "unlink: $f1 failed"; - ! -e $f1 or die "unlink didn't work"; - } - if ( -e $f2 ) { - unlink( $f2 ) or die "unlink: $f2 failed"; - ! -e $f2 or die "unlink didn't work"; - } - if ( -e $f3 ) { - unlink( $f3 ) or die "unlink: $f3 failed"; - ! -e $f3 or die "unlink didn't work"; - } - if ( -e $s ) { - rmdir( $s ) or die "rmdir: $s failed"; - ! -e $s or die "rmdir didn't work"; - } + if ( -e $f1 ) { + unlink( $f1 ) or die "unlink: $f1 failed"; + ! -e $f1 or die "unlink didn't work"; + } + if ( -e $f2 ) { + unlink( $f2 ) or die "unlink: $f2 failed"; + ! -e $f2 or die "unlink didn't work"; + } + if ( -e $f3 ) { + unlink( $f3 ) or die "unlink: $f3 failed"; + ! -e $f3 or die "unlink didn't work"; + } + if ( -e $s ) { + rmdir( $s ) or die "rmdir: $s failed"; + ! -e $s or die "rmdir didn't work"; + } } # Make sure there is no directory from a previous run @@ -70,7 +70,7 @@ create_directory(); # Schedule cleanup END { - clear_directory(); + clear_directory(); } diff --git a/t/09_fork.t b/t/09_fork.t index 029cfb3..7c9723c 100644 --- a/t/09_fork.t +++ b/t/09_fork.t @@ -4,8 +4,8 @@ use strict; BEGIN { - $| = 1; - $^W = 1; + $| = 1; + $^W = 1; } use Test::More tests => 8; @@ -25,13 +25,13 @@ ok( -d $parent, 'Directory exists' ); # Fork the test my $pid = fork(); unless ( $pid ) { - # Create a child-owned directory and flag for deletion - File::Remove::clear($child); - mkdir( $child, 0777 ); - sleep(2); + # Create a child-owned directory and flag for deletion + File::Remove::clear($child); + mkdir( $child, 0777 ); + sleep(2); - # Exit from the child to stimulate END-time code - exit(0); + # Exit from the child to stimulate END-time code + exit(0); } # In the parent, wait 1 second for process to spawn diff --git a/t/release-cpan-changes.t b/t/release-cpan-changes.t deleted file mode 100644 index 214650f..0000000 --- a/t/release-cpan-changes.t +++ /dev/null @@ -1,19 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -use strict; -use warnings; - -use Test::More 0.96 tests => 2; -use_ok('Test::CPAN::Changes'); -subtest 'changes_ok' => sub { - changes_file_ok('Changes'); -}; -done_testing(); diff --git a/t/release-kwalitee.t b/t/release-kwalitee.t deleted file mode 100644 index e641ee8..0000000 --- a/t/release-kwalitee.t +++ /dev/null @@ -1,19 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -# This test is generated by Dist::Zilla::Plugin::Test::Kwalitee::Extra -use strict; -use warnings; -use Test::More; # needed to provide plan. - -eval { require Test::Kwalitee::Extra }; -plan skip_all => "Test::Kwalitee::Extra required for testing kwalitee: $@" if $@; - -eval "use Test::Kwalitee::Extra"; diff --git a/xt/author/eol.t b/xt/author/eol.t new file mode 100644 index 0000000..d62f32b --- /dev/null +++ b/xt/author/eol.t @@ -0,0 +1,25 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 + +use Test::More 0.88; +use Test::EOL; + +my @files = ( + 'lib/File/Remove.pm', + 't/00-compile.t', + 't/01_compile.t', + 't/02_directories.t', + 't/03_deep_readonly.t', + 't/04_can_delete.t', + 't/05_links.t', + 't/06_curly.t', + 't/07_cwd.t', + 't/08_spaces.t', + 't/09_fork.t', + 't/10_noglob.t' +); + +eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; +done_testing; diff --git a/xt/author/no-tabs.t b/xt/author/no-tabs.t new file mode 100644 index 0000000..183cd80 --- /dev/null +++ b/xt/author/no-tabs.t @@ -0,0 +1,25 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 + +use Test::More 0.88; +use Test::NoTabs; + +my @files = ( + 'lib/File/Remove.pm', + 't/00-compile.t', + 't/01_compile.t', + 't/02_directories.t', + 't/03_deep_readonly.t', + 't/04_can_delete.t', + 't/05_links.t', + 't/06_curly.t', + 't/07_cwd.t', + 't/08_spaces.t', + 't/09_fork.t', + 't/10_noglob.t' +); + +notabs_ok($_) foreach @files; +done_testing; diff --git a/t/author-pod-coverage.t b/xt/author/pod-coverage.t index 094d8f5..66b3b64 100644 --- a/t/author-pod-coverage.t +++ b/xt/author/pod-coverage.t @@ -1,12 +1,4 @@ #!perl - -BEGIN { - unless ($ENV{AUTHOR_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for testing by the author'); - } -} - # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; diff --git a/t/author-pod-syntax.t b/xt/author/pod-syntax.t index 35fb1b9..e563e5d 100644 --- a/t/author-pod-syntax.t +++ b/xt/author/pod-syntax.t @@ -1,12 +1,4 @@ #!perl - -BEGIN { - unless ($ENV{AUTHOR_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for testing by the author'); - } -} - # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; diff --git a/xt/release/cpan-changes.t b/xt/release/cpan-changes.t new file mode 100644 index 0000000..286005a --- /dev/null +++ b/xt/release/cpan-changes.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 + +use Test::More 0.96 tests => 1; +use Test::CPAN::Changes; +subtest 'changes_ok' => sub { + changes_file_ok('Changes'); +}; diff --git a/t/release-trailing-space.t b/xt/release/trailing-space.t index 55df58a..e385619 100644 --- a/t/release-trailing-space.t +++ b/xt/release/trailing-space.t @@ -1,13 +1,5 @@ #!perl -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - use strict; use warnings; |