http://www.perlmonks.org?node_id=344938


in reply to run htpasswd as unix command in the program

Umm. I usually skip right over using the htpasswd program from apache and just write the file directly from Perl.

my $PASSFILE="/pathto/file/.htpasswd"; open(WRT,">$PASSFILE"); my $id_password; # this is where I pull the list of id's # and passwords from a database or file, # then populate $id_password->{id}=pass; $id_password->{'richard'} = "mypass"; foreach my $id (keys %{$id_password}){ my $pass = $id_password->{$id}; my $pass2 = crypt($pass, "Ce"); print WRT "$id:$pass2\n"; } close(WRT);
You can use other two letter combinations in the seed part of that crypt statement. "Ce" or "xV" or whatever.