lib/Ius/Dav/Htpasswd.pm
changeset 8 f5e94db98601
parent 5 b546c800107e
child 9 4227cf8872b8
--- a/lib/Ius/Dav/Htpasswd.pm	Thu Jul 07 14:02:45 2011 +0200
+++ b/lib/Ius/Dav/Htpasswd.pm	Thu Jul 07 14:18:54 2011 +0200
@@ -24,11 +24,11 @@
 use strict;
 use warnings;
 
-use Apache::Htpasswd;
-use AppConfig;
+use Apache::Htpasswd qw();
+use AppConfig qw();
 use File::Path qw(rmtree);
-use POSIX;
-use String::MkPasswd qw(mkpasswd);
+use POSIX qw();
+use String::MkPasswd qw();
 
 BEGIN {
 
@@ -39,7 +39,7 @@
     $VERSION = 0.1;
 
     @ISA    = qw(Exporter);
-    @EXPORT_OK = qw(readconfig useradd userdel usage);
+    @EXPORT_OK = qw(readconfig mkpasswd useradd userdel usage);
 }
 
 sub usage {
@@ -86,7 +86,7 @@
 
 sub useradd {
 
-    my ($conf, $user, $expiry) = @_;
+    my ($conf, $user, $pass, $expiry) = @_;
 
     for (qw(expiry expiry_min expiry_max dav_base htpasswd conf_d www_user www_group)) {
         die "Can't determine '$_' - please check configuration"
@@ -110,7 +110,6 @@
     my $www_gid = getgrnam $www_group or die "Can't getgrnam '$www_group'";
     chown $www_uid, $www_gid, "$user_dir" or die "Can't chown, '$www_uid', '$www_gid', '$user_dir': $!";
 
-    my $pass = mkpasswd;
     my $htpasswd_file = $conf->{htpasswd};
     unless (-e $htpasswd_file ) {
         open H, '>>', $htpasswd_file or die "Can't create '$htpasswd_file': $!";
@@ -144,6 +143,8 @@
 
 }
 
+sub mkpasswd { return String::MkPasswd::mkpasswd; }
+
 sub userdel {
 
     my ($conf, $user) = @_;