return a value from userexpiry; deal with return value from userdel; deal with lacking error message from File::Path::rmtree in case the tree has already been removed foerste
authorMatthias Förste <foerste@schlittermann.de>
Wed, 20 Jul 2011 12:42:15 +0200
branchfoerste
changeset 51 0551002b6228
parent 50 24c400b32505
child 52 c892bf85383e
return a value from userexpiry; deal with return value from userdel; deal with lacking error message from File::Path::rmtree in case the tree has already been removed
lib/Ius/Dav/Htpasswd.pm
--- a/lib/Ius/Dav/Htpasswd.pm	Wed Jul 20 11:49:23 2011 +0200
+++ b/lib/Ius/Dav/Htpasswd.pm	Wed Jul 20 12:42:15 2011 +0200
@@ -171,8 +171,8 @@
     my $err;
     rmtree( $user_dir, error => $err )
       or $rc = -1
-      and defined $err
-      and warn "Errors occurred during rmtree '$user_dir': ", @{$err};
+      and warn "Error(s) occurred during rmtree '$user_dir': ",
+        defined $err ? @{$err} : '';
 
     my $htpasswd_file = $conf->{htpasswd};
     my $htpasswd      = new Apache::Htpasswd $htpasswd_file;
@@ -194,6 +194,8 @@
 
     my ($conf) = @_;
 
+    my $rc = 0;
+
     for (qw(htpasswd)) {
         die "Can't determine '$_' - please check configuration"
           unless defined $conf->{$_};
@@ -208,7 +210,7 @@
     for my $u (@users) {
         if ( my $e = $htpasswd->fetchInfo($u) ) {
             userdel( $conf, $u )
-              or warn "Can't 'userdel $conf, $u'\n"
+                and warn "Error(s) occured during 'userdel $conf, $u'\n"
               if $now >= $e;
         }
         else {
@@ -216,6 +218,8 @@
         }
     }
 
+    return $rc;
+
 }
 
 1;