File: load_modules.pl.PL

package info (click to toggle)
libapache-mod-perl 1.16-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,580 kB
  • ctags: 1,064
  • sloc: ansic: 4,489; perl: 4,415; sh: 305; makefile: 137
file content (51 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use File::Find;
use strict;
my $APACHE_SRC = shift;

my $LoadModule_conf = "t/conf/LoadModule.conf";
my $tmp = "t/conf/httpd.conf.new";
my $orig = "t/conf/httpd.conf";

local *ORIG;
open ORIG, $orig or die "can't open $orig $!";
while(<ORIG>) {
    if(/^LoadModule/) {
	exit 0; #already cat-ed
    } 
}
unless (-d "t") {
    chdir "..";
}
#phooey, this mess should have been cleaned up before 1.3.0
my $name_map = {
    log_config => "config_log",
    include => "includes",
    actions => "action",
    auth_anon => "anon_auth",
    auth_dbm => "dbm_auth",
};

my @sh_mods = ();
finddepth(sub {
    return unless /(mod_|lib)(.*)\.s[ol]$/;
    my $name = $name_map->{$2} || $2;
    my $full = "$File::Find::dir/$_";
    if($full !~ m,^/,) {
	if($full =~ m,^\.\./,) {
	    $full = "../$full";
	}
    }
    push @sh_mods, "LoadModule ${name}_module $full";
}, $APACHE_SRC);

my($perl_mod) = grep /perl/, @sh_mods;
unshift @sh_mods, $perl_mod; #must come before mod_include/USE_PERL_SSI
  
local *FH;
open FH, ">$LoadModule_conf" or
    die "can't open $LoadModule_conf $!";
print FH join "\n", @sh_mods, "";
close FH;

system "cat $LoadModule_conf $orig > $tmp && mv $tmp $orig";