[Catalyst-commits] r8521 - in trunk/Authen-Htpasswd: . lib/Authen

ningu at dev.catalyst.perl.org ningu at dev.catalyst.perl.org
Sun Oct 12 20:16:13 BST 2008


Author: ningu
Date: 2008-10-12 20:16:12 +0100 (Sun, 12 Oct 2008)
New Revision: 8521

Modified:
   trunk/Authen-Htpasswd/Changes
   trunk/Authen-Htpasswd/lib/Authen/Htpasswd.pm
Log:
update Authen::Htpasswd to fix bugs

Modified: trunk/Authen-Htpasswd/Changes
===================================================================
--- trunk/Authen-Htpasswd/Changes	2008-10-12 00:31:07 UTC (rev 8520)
+++ trunk/Authen-Htpasswd/Changes	2008-10-12 19:16:12 UTC (rev 8521)
@@ -1,3 +1,7 @@
+0.161   Sun Oct 12 12:13:27 PDT 2008
+    - fix stupid bug when trying to add a user that already exists (RT #37785)
+    - fix \Q in regular expressions for newer versions of perl (RT #27012)
+
 0.16    Sun Jul 15 15:20:28 PDT 2007
     - Disable write locking on Win32.
       (On Win32 you cannot delete a file with an open filehandle)

Modified: trunk/Authen-Htpasswd/lib/Authen/Htpasswd.pm
===================================================================
--- trunk/Authen-Htpasswd/lib/Authen/Htpasswd.pm	2008-10-12 00:31:07 UTC (rev 8520)
+++ trunk/Authen-Htpasswd/lib/Authen/Htpasswd.pm	2008-10-12 19:16:12 UTC (rev 8521)
@@ -9,7 +9,7 @@
 
 use vars qw{$VERSION $SUFFIX};
 BEGIN {
-    $VERSION = '0.16';
+    $VERSION = '0.161';
     $SUFFIX = '.new';
 }
 
@@ -188,7 +188,7 @@
     my ($old,$new) = $self->_start_rewrite;
     my $seen = 0;
     while (defined(my $line = <$old>)) {
-        if ($line =~ /^\Q$username\:/) {
+        if ($line =~ /^\Q$username\E:/) {
             chomp $line;
             my (undef,undef, at extra_info) = split /:/, $line;
             $user->{extra_info} ||= [ @extra_info ] if scalar @extra_info;
@@ -219,8 +219,8 @@
 
     my ($old,$new) = $self->_start_rewrite;
     while (defined(my $line = <$old>)) {
-        if ($line =~ /^\Q$username\:/) {
-            $self->_abort_rewrite;
+        if ($line =~ /^\Q$username\E:/) {
+            $self->_abort_rewrite($old,$new);
             croak "user $username already exists in " . $self->file . "!";
         }
         $self->_print( $new, $line );
@@ -244,7 +244,7 @@
 
     my ($old,$new) = $self->_start_rewrite;
     while (defined(my $line = <$old>)) {
-        next if $line =~ /^\Q$username\:/;
+        next if $line =~ /^\Q$username\E:/;
         $self->_print( $new, $line );
     }
     $self->_finish_rewrite($old,$new);




More information about the Catalyst-commits mailing list