bin/ius-dav-htuseradd
branchfoerste
changeset 25 8934ba3404bc
parent 16 44cdd9d6fd8c
child 28 9d0a1a1b70a7
equal deleted inserted replaced
24:6426cf731f25 25:8934ba3404bc
    23 use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd usage);
    23 use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd usage);
    24 
    24 
    25 use Getopt::Long;
    25 use Getopt::Long;
    26 use Pod::Usage;
    26 use Pod::Usage;
    27 
    27 
    28 my ($user, $expiry, $pass);
    28 my ( $user, $expiry, $pass );
    29 
    29 
    30 GetOptions(
    30 GetOptions(
    31     'u|user=s' => \$user,
    31     'u|user=s'   => \$user,
    32     'e|expiry=i' => \$expiry,
    32     'e|expiry=i' => \$expiry,
    33     'h|help' => sub { usage(-exit => 0, -verbose => 1) },
    33     'h|help'     => sub { usage( -exit => 0, -verbose => 1 ) },
    34     'm|man'  => sub {
    34     'm|man'      => sub {
    35         usage(
    35         usage(
    36             -exit => 0,
    36             -exit => 0,
    37 
    37 
    38             # "system('perldoc -V &>/dev/null')" appears shorter, but may not
    38             # "system('perldoc -V &>/dev/null')" appears shorter, but may not
    39             # do what you expect ( it still returns 0 on debian squeeze with
    39             # do what you expect ( it still returns 0 on debian squeeze with
    40             # dash as system shell even if cannot find the command in $PATH)
    40             # dash as system shell even if cannot find the command in $PATH)
    41             -noperldoc => system('perldoc -V >/dev/null 2>&1'),
    41             -noperldoc => system('perldoc -V >/dev/null 2>&1'),
    42             -verbose   => 2
    42             -verbose   => 2
    43         );
    43         );
    44     },
    44     },
    45 ) and defined $user or usage;
    45   )
       
    46   and defined $user
       
    47   or usage;
    46 
    48 
    47 $pass = useradd readconfig, $user, mkpasswd, $expiry;
    49 $pass = useradd readconfig, $user, mkpasswd, $expiry;
    48 print "[$pass]\n";
    50 print "[$pass]\n";