Appease perlcritic
[apache2-authen-passphrase.git] / lib / Apache2 / Authen / Passphrase.pm
index 59ac4d437548a498b495464c428049ae15eeec4a..ae8d01c7d33b0fb99871c71aa86fa13fa71d477f 100644 (file)
@@ -1,19 +1,17 @@
 package Apache2::Authen::Passphrase;
 
-our $VERSION = 0.002001;
-
 use 5.014000;
 use strict;
 use warnings;
 use parent qw/Exporter/;
 use subs qw/OK HTTP_UNAUTHORIZED/;
 
-use constant +{
-  USER_REGEX => qr/^\w{2,20}$/pa,
-  PASSPHRASE_VERSION => 1,
-  INVALID_USER => "invalid-user\n",
-  BAD_PASSWORD => "bad-password\n",
-};
+our $VERSION = 0.002001;
+
+use constant USER_REGEX => qr/^\w{2,20}$/pas;
+use constant PASSPHRASE_VERSION => 1;
+use constant INVALID_USER => "invalid-user\n";
+use constant BAD_PASSWORD => "bad-password\n";
 
 use if $ENV{MOD_PERL}, 'Apache2::RequestRec';
 use if $ENV{MOD_PERL}, 'Apache2::Access';
@@ -26,7 +24,8 @@ our @EXPORT_OK = qw/pwset pwcheck pwhash USER_REGEX PASSPHRASE_VERSION INVALID_U
 
 ##################################################
 
-our $rootdir //= $ENV{AAP_ROOTDIR};
+our $rootdir;
+$rootdir //= $ENV{AAP_ROOTDIR};
 
 sub pwhash{
   my ($pass)=@_;
@@ -54,12 +53,14 @@ sub pwset{
 
 sub pwcheck{
   my ($user, $pass)=@_;
-  die INVALID_USER unless $user =~ USER_REGEX;
+  die INVALID_USER unless $user =~ USER_REGEX; ## no critic (RequireCarping)
   $user=${^MATCH};# Make taint shut up
   my $conf=LoadFile "$rootdir/$user.yml";
 
+  ## no critic (RequireCarping)
   die BAD_PASSWORD unless keys $conf;# Empty hash means no such user
   die BAD_PASSWORD unless Authen::Passphrase->from_rfc2307($conf->{passphrase})->match($pass);
+  ## use critic
   pwset $user, $pass if $conf->{passphrase_version} < PASSPHRASE_VERSION
 }
 
This page took 0.010065 seconds and 4 git commands to generate.