Make mod_perl optional
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 28 Feb 2014 21:19:29 +0000 (23:19 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 28 Feb 2014 21:19:29 +0000 (23:19 +0200)
Makefile.PL
lib/Apache2/Authen/Passphrase.pm

index 3ac11e8d4e8380891d8e6bcb1bc5525ecb46355f..35d9b4429028815a8047166c27463e02254dd37a 100644 (file)
@@ -1,4 +1,5 @@
 use ExtUtils::MakeMaker;
+use 5.014000;
 
 WriteMakefile(
     NAME             => 'Apache2::Authen::Passphrase',
@@ -9,12 +10,16 @@ WriteMakefile(
        LICENSE          => 'perl',
        EXE_FILES        => [ 'aap-passwd' ],
     PREREQ_PM        => {
-         Apache2::RequestRec => 0,
-         Apache2::Access => 0,
-         Apache2::Const => 0,
-         Authen::Passphrase => 0,
-         Authen::Passphrase::BlowfishCrypt => 0,
-         IO::Prompter => 0,
-         YAML::Any => 0,
+               qw/Authen::Passphrase                0
+                  Authen::Passphrase::BlowfishCrypt 0
+                  IO::Prompter                      0
+                  YAML::Any                         0/,
        },
+       META_MERGE       => {
+               recommends   => {
+                       qw/Apache2::RequestRec 0
+                          Apache2::Access     0
+                          Apache2::Const      0/,
+               }
+       }
 );
index bea2bca35a2fb3e1728ac4cc4a4c2c5e1f9ffc49..e8a157991eba0dfd3c30549583feae52326eee4b 100644 (file)
@@ -6,6 +6,7 @@ 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,
@@ -14,9 +15,9 @@ use constant +{
   BAD_PASSWORD => "bad-password\n",
 };
 
-use Apache2::RequestRec;
-use Apache2::Access;
-use Apache2::Const qw/OK HTTP_UNAUTHORIZED/;
+use if $ENV{MOD_PERL}, 'Apache2::RequestRec';
+use if $ENV{MOD_PERL}, 'Apache2::Access';
+use if $ENV{MOD_PERL}, 'Apache2::Const' => qw/OK HTTP_UNAUTHORIZED/;
 use Authen::Passphrase;
 use Authen::Passphrase::BlowfishCrypt;
 use YAML::Any qw/LoadFile DumpFile/;
This page took 0.01215 seconds and 4 git commands to generate.