in reply to Strange behaviour in Apache::Htpasswd::htpasswd()

I'm not getting the same behaviour on my box.

I notice that you're not checking the return values of htpasswd. The method can fail, so looking at the return values might give you a clue ;-)

The following test script runs fine on my box...

#! /usr/bin/perl use strict; use warnings; use Apache::Htpasswd '1.5.4'; use Test::More tests => 13; my $TEST_FILE = "test_htpasswd.txt"; die "$TEST_FILE file already exists\n" if -e $TEST_FILE; # setup our test fixture { open(FILE, '>', $TEST_FILE) or die; close(FILE) or die; my $pwd = new Apache::Htpasswd($TEST_FILE); foreach (1..6) { $pwd->htpasswd("user$_", "pass$_") or die "failed to add user$_ " . $pwd->error . "\n"; }; }; my $pwd = new Apache::Htpasswd($TEST_FILE); foreach my $n (1..6) { ok($pwd->htCheckPassword("user$n", "pass$n"), "user $n added"); }; ok($pwd->htpasswd('user3', 'newpwd3', 1), "password for user3 changed" +) or diag "error reported was " . $pwd->error; foreach my $n (1..6) { my $pass = ($n==3) ? "newpwd3" : "pass$n"; ok($pwd->htCheckPassword("user$n", $pass), "user $n still valid"); }; unlink $TEST_FILE or die "could not unlink $TEST_FILE\n";