diff -r eea8bbbf3818 -r 2b8cf6a91d0b bin/ius-dav-htuseradd --- a/bin/ius-dav-htuseradd Fri Jul 22 09:38:29 2011 +0200 +++ b/bin/ius-dav-htuseradd Fri Sep 06 13:56:57 2013 +0200 @@ -20,7 +20,7 @@ use strict; use warnings; -use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd usage); +use Ius::Dav::Htpasswd; use Getopt::Long; use Pod::Usage; @@ -30,9 +30,9 @@ GetOptions( 'u|user=s' => \$user, 'e|expiry=i' => \$expiry, - 'h|help' => sub { usage( -exit => 0, -verbose => 1 ) }, + 'h|help' => sub { Ius::Dav::Htpasswd::usage( -exit => 0, -verbose => 1 ) }, 'm|man' => sub { - usage( + Ius::Dav::Htpasswd::usage( -exit => 0, # "system('perldoc -V &>/dev/null')" appears shorter, but may not @@ -44,7 +44,9 @@ }, ) and defined $user - or usage; + or Ius::Dav::Htpasswd::usage; -$pass = useradd readconfig, $user, mkpasswd, $expiry; +my $h = Ius::Dav::Htpasswd->new; +$h->readconfig or die "Can't readconfig"; +$pass = $h->useradd($user, Ius::Dav::Htpasswd::mkpasswd, $expiry); print "$pass\n";