1ModPerl::Code(3) User Contributed Perl Documentation ModPerl::Code(3)
2
3
4
7 EOF
8
9 my $groups = $data{$class};
10 for my $group (sort keys %$groups) {
11 print $fh <<"EOF";
12
13 ":$group"
14
15 use $class\::Const -compile qw(:$group);
16
17 The ":$group" group is for XXX constants.
18
19 EOF
20
21 for my $const (sort @{ $groups->{$group} }) {
22 print $fh "=head3 C<$class\::$const>\n\n\n";
23 }
24 }
25
26 print $fh "=cut\n";
27 }
28 }
29
30 sub generate_constants_lookup_doc {
31 my ($data) = @_;
32
33 while (my ($class, $groups) = each %$Apache2::ConstantsTable) {
34 my $constants = [map { @$_ } values %$groups];
35
36 constants_lookup_code_doc($constants, $class, $data);
37 }
38 }
39
40 sub generate_constants_group_lookup_doc {
41 my ($data) = @_;
42
43 while (my ($class, $groups) = each %$Apache2::ConstantsTable) {
44 constants_group_lookup_code_doc($class, $groups, $data);
45 }
46 }
47
48 sub constants_group_lookup_code_doc {
49 my ($class, $groups, $data) = @_;
50 my @tags;
51 my @code;
52
53 while (my ($group, $constants) = each %$groups) {
54 $data->{$class}{$group} = [
55 map {
56 my @ifdef = constants_ifdef($_);
57 s/^($constant_prefixes)_?//o;
58 $seen_const{$class}{$_}++;
59 $_;
60 } @$constants
61 ];
62 }
63 }
64
65 sub constants_lookup_code_doc {
66 my ($constants, $class, $data) = @_;
67
68 my (%switch, %alias);
69
70 %alias = %shortcuts;
71
72 my $postfix = lc $class;
73 my $package = $class . '::';
74 my $package_len = length $package;
75
76 my $func = canon_func(qw(constants lookup), $postfix);
77
78 for (@$constants) {
79 if (s/^($constant_prefixes)(_)?//o) {
80 $alias{$_} = join $2 ⎪⎪ "", $1, $_;
81 }
82 else {
83 $alias{$_} ⎪⎪= $_;
84 }
85 next unless /^([A-Z])/;
86 push @{ $switch{$1} }, $_;
87 }
88
89 for my $key (sort keys %switch) {
90 my $names = $switch{$key};
91 for my $name (@$names) {
92 my @ifdef = constants_ifdef($alias{$name});
93 push @{ $data->{$class}{other} }, $name
94 unless $seen_const{$class}{$name}
95 }
96 }
97 }
98
99 sub generate_exports {
100 my ($self, $c_fh) = @_;
101 require ModPerl::WrapXS;
102 ModPerl::WrapXS->generate_exports($c_fh); }
103
104 # src/modules/perl/*.c files needed to build APR/APR::* outside # of
105 mod_perl.so sub src_apr_ext {
106 return map { "modperl_$_" } (qw(error bucket),
107 map { "common_$_" } qw(util log)); }
108
109 1; __END__
110
112 ModPerl::Code - Generate mod_perl glue code
113
115 use ModPerl::Code ();
116 my $code = ModPerl::Code->new;
117 $code->generate;
118
120 This module provides functionality for generating mod_perl glue code.
121 Reason this code is generated rather than written by hand include:
122
123 consistency
124 thin and clean glue code
125 enable/disable features (without #ifdefs)
126 adapt to changes in Apache
127 experiment with different approaches to gluing
128
130 Doug MacEachern
131
132
133
134perl v5.8.8 2006-11-19 ModPerl::Code(3)