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";
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|