File: load_modules.pl

package info (click to toggle)
apache-perl 1.3.9-14.1-1.21.20000309-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,524 kB
  • ctags: 1,743
  • sloc: ansic: 9,017; perl: 7,822; sh: 864; makefile: 695
file content (56 lines) | stat: -rwxr-xr-x 1,359 bytes parent folder | download | duplicates (3)
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
52
53
54
55
56
#!/usr/bin/perl
#! /usr/local/bin/perl
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",
    log_agent => "agent_log",
    log_referer => "referer_log"
};

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";
	}
    }
    return if $name =~ /(auth|autoindex|digest)/; #a few that screw make test
    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";