File: mod_perl.pm

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 (58 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (2)
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
57
58
package mod_perl;
use 5.003_97;
use strict;
use DynaLoader ();

BEGIN {
    $mod_perl::VERSION = "1.2103";
}

sub boot {
    my($class, $version) = @_;
    no strict 'refs';
    *{$class.'::dl_load_flags'} = DynaLoader->can('dl_load_flags');
    if ($ENV{MOD_PERL}) {
        (defined &{$class.'::bootstrap'} ?
         \&{$class.'::bootstrap'} :
         \&DynaLoader::bootstrap)->
             ($class, $version);
    }
}

sub hook {
    my $hook = shift;
    return 1 if $hook =~ /^PerlHandler$/;

    (my $try = $hook) =~ s/^Perl//;
    $try =~ s/Handler$//;
    return Apache::perl_hook($try) > 0;
}

sub import {
    my $class = shift;

    return unless @_;

    if($_[0] =~ /^\d/) {
	$class->UNIVERSAL::VERSION(shift);
    }
    return unless $ENV{MOD_PERL};

    for my $hook (@_) {
	require Apache;
	my $enabled = hook($hook); 
	next if $enabled > 0;
	if($enabled < 0) {
	    die "unknown mod_perl option `$hook'\n";
	}
	else {
	    (my $flag = $hook) =~ s/([A-Z])/_$1/g;
	    $flag = uc $flag;
	    die "`$hook' not enabled, rebuild mod_perl with PERL$flag=1\n";
	}
    }
}

1;

__END__