Hi

I want to use rmtree to delete a dir and use variables to catch the
error message. However, when i am about to delete a dir that does not
belong to me, it still print the error message to stderr. Does anyone
have clue?

my script: test.pl

use File::Path;
File::Path::rmtree( '/root', {error => \$err, safe => 1, result =>
\$list, keep_root => 1} );
for my $diag (@$err) {
    my ($file, $message) = each %$diag;
    print "problem unlinking $file: $message\n";
}
print "unlinked $_\n" for @$list;

$ test.pl
Can't make directory /root read+writeable: Operation not permitted at
a.pl line 2
Can't read /root: Permission denied at a.pl line 2
rmdir /root
Can't remove directory /root: Permission denied at a.pl line 2
and can't restore permissions to 0750
 at a.pl line 2

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to