From 1a0dffdd639c1d7fc5190113e9609cdfda1abbb5 Mon Sep 17 00:00:00 2001
From: Thomas Bellman <bellman@nsc.liu.se>
Date: Thu, 6 Feb 2014 17:57:56 +0100
Subject: [PATCH] Add class apache::mod_perl for managing the mod_perl module.

---
 manifests/mod_perl.pp | 59 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 manifests/mod_perl.pp

diff --git a/manifests/mod_perl.pp b/manifests/mod_perl.pp
new file mode 100644
index 0000000..6711a22
--- /dev/null
+++ b/manifests/mod_perl.pp
@@ -0,0 +1,59 @@
+import "apache"
+
+
+/*
+ * Install the Apache mod_perl module.
+ */
+class apache::mod_perl
+{
+    include apache
+
+    $default_options = {
+	# Enable taint checking by default.  Lots of Perl modules fail with
+	# this, though, so users may need to disable this.
+	'PerlSwitches'		=> '-T',
+    }
+    package {
+	'mod_perl':
+	    ensure => installed,
+	    # We want conf.d to be cleaned up from whatever mod_perl puts there
+	    before => File[$apache::configdir];
+    }
+    apache::module::globalconfig {
+	'perl':
+	    loadmodule => 'perl_module modules/mod_perl.so',
+	    directives => [],
+	    defaultoptions => $default_options,
+	    options => { },
+	    require => Package['mod_perl'];
+    }
+}
+
+
+/*
+ * As apache::mod_perl, but do not run Perl in taint mode.
+ */
+class apache::mod_perl::notaint
+      inherits apache::mod_perl
+{
+    Apache::Module::Globalconfig['perl'] {
+	defaultoptions => { },
+    }
+}
+
+
+class apache::mod_perl::absent
+      inherits apache::mod_perl
+{
+    # Remove the configuration referencing the module before the actual
+    # module, in case the machine reboots in the middle.
+    Package['mod_perl'] {
+	ensure => absent,
+	before => [],
+    }
+    Apache::Module::Globalconfig['perl'] {
+	ensure => absent,
+	require => [],
+	before => Package['mod_perl'],
+    }
+}
-- 
GitLab