Subject: | File::Path::remove_tree option hash is auto populated and cannot be reused for a second call without warnings |
File::Path::remove_tree (and maybe more) is using the options hashref passed internally and populate it with noise...
You cannot set an hashref for options and reuse it for another call as it s going to be polluted and you will noticed some warning
Wonder if it s an expected behavior or if the hashref should be localized...
Note that when using version 2.09 this could be used without warnings... whereas after the update to 2.12 now this is adding a warning (which is a good thing) for unknown options
mkdir -p /tmp/a/b/c; perl -w -MFile::Path -E 'use warnings; my $x= ""; my $opts = { error => \$x }; File::Path::remove_tree("/tmp/a/b/c", $opts ); File::Path::remove_tree("/tmp/a/b", $opts ); say $File::Path::VERSION; use Test::More; note explain $opts'
Unrecognized option(s) passed to remove_tree(): cwd depth device inode perm prefix at -e line 1.
2.1201
# {
# 'cwd' => '/usr/local/cpanel',
# 'depth' => 0,
# 'device' => 64769,
# 'error' => \[],
# 'inode' => 68670914,
# 'perm' => undef,
# 'prefix' => ''
# }