From 788a3738b30591768f1843f0b00d7a3cfd820358 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 28 Feb 2014 23:19:29 +0200 Subject: [PATCH] Make mod_perl optional --- Makefile.PL | 19 ++++++++++++------- lib/Apache2/Authen/Passphrase.pm | 7 ++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 3ac11e8..35d9b44 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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/, + } + } ); diff --git a/lib/Apache2/Authen/Passphrase.pm b/lib/Apache2/Authen/Passphrase.pm index bea2bca..e8a1579 100644 --- a/lib/Apache2/Authen/Passphrase.pm +++ b/lib/Apache2/Authen/Passphrase.pm @@ -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/; -- 2.39.2