aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@rbsd.ankarstrom.se>2021-04-25 14:30:59 +0000
committerroot <root@rbsd.ankarstrom.se>2021-04-25 14:30:59 +0000
commit17b219d8c1c3116158f14b8005561be2de11e7c4 (patch)
tree513fbdded77f24e5c6b8969c70c442370200c822
parentf17c54a6e8c837c7de221e717830c1e9df9ce74f (diff)
downloadApache-Inject-17b219d8c1c3116158f14b8005561be2de11e7c4.tar.gz
Skip tests if run as root
Otherwise, I suspect App::Cpan will not be able to install the module without workarounds on the part of the user.
-rw-r--r--Makefile.PL1
-rw-r--r--README9
-rw-r--r--lib/Apache/Inject.pm10
-rw-r--r--lib/Apache/Inject/Handler.pm1
-rwxr-xr-xt/SMOKE2
-rw-r--r--t/TEST.PL11
6 files changed, 25 insertions, 9 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 6a635dd..d8bd7bd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -31,6 +31,7 @@ WriteMakefile(
Apache2::Module => 0,
Apache2::RequestRec => 0,
Apache2::RequestUtil => 0,
+ mod_perl2 => 0,
},
clean => {
FILES => 't/TEST',
diff --git a/README b/README
index 5e55314..f090522 100644
--- a/README
+++ b/README
@@ -60,8 +60,13 @@ INSTALLATION
make test
make install
- Note that the Apache::* and Apache2::* dependencies are included with
- mod_perl2.
+ Note that all steps in this process require mod_perl2 to be installed. I
+ recommend installing mod_perl2 before trying to install Apache::Inject.
+
+ Note further that, because they depend on Apache, the tests require an
+ unprivileged user and will be skipped if they are run as root. This is
+ relevant if you install Apache::Inject via App::Cpan, which normally
+ runs as root.
OPERATION
Behind the scenes, the Inject directive works as an alias for
diff --git a/lib/Apache/Inject.pm b/lib/Apache/Inject.pm
index 8de0249..a8bd520 100644
--- a/lib/Apache/Inject.pm
+++ b/lib/Apache/Inject.pm
@@ -5,6 +5,7 @@ use strict;
our $VERSION = '0.01';
+use mod_perl2;
use Apache2::CmdParms ();
use Apache2::Const qw/OR_LIMIT OR_AUTHCFG TAKE12/;
use Apache2::Log ();
@@ -119,8 +120,13 @@ To install this module type the following:
make test
make install
-Note that the Apache::* and Apache2::* dependencies are included
-with mod_perl2.
+Note that all steps in this process require mod_perl2 to be installed.
+I recommend installing mod_perl2 before trying to install Apache::Inject.
+
+Note further that, because they depend on Apache, the tests require
+an unprivileged user and will be skipped if they are run as root.
+This is relevant if you install Apache::Inject via App::Cpan, which
+normally runs as root.
=head1 OPERATION
diff --git a/lib/Apache/Inject/Handler.pm b/lib/Apache/Inject/Handler.pm
index af93392..10d9d0c 100644
--- a/lib/Apache/Inject/Handler.pm
+++ b/lib/Apache/Inject/Handler.pm
@@ -3,6 +3,7 @@ package Apache::Inject::Handler;
use 5.010000;
use strict;
+use mod_perl2;
use Apache2::Const qw/OK DECLINED/;
use Apache2::Log ();
use Apache2::RequestRec ();
diff --git a/t/SMOKE b/t/SMOKE
index ede8397..9f53a8f 100755
--- a/t/SMOKE
+++ b/t/SMOKE
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
# WARNING: this file is generated, do not edit
-# generated on Sun Apr 25 00:00:31 2021
+# generated on Sun Apr 25 14:30:31 2021
# 01: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestConfig.pm:1003
# 02: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestConfig.pm:1095
# 03: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestSmoke.pm:775
diff --git a/t/TEST.PL b/t/TEST.PL
index 6c1c41c..b1778b2 100644
--- a/t/TEST.PL
+++ b/t/TEST.PL
@@ -2,9 +2,12 @@
use strict;
use warnings FATAL => 'all';
-
-use lib qw(lib);
-
+use lib qw/lib/;
use Apache::TestRunPerl ();
-Apache::TestRunPerl->new->run(@ARGV);
+if ($> == 0) {
+ print STDERR "Skipping tests, as they must be run as an unprivileged user\n";
+}
+else {
+ Apache::TestRunPerl->new->run(@ARGV);
+}