1ModPerl::Code(3)      User Contributed Perl Documentation     ModPerl::Code(3)
2
3
4

NAME

6       $class\::Const - Perl Interface for $class Constants
7

SYNOPSIS

CONSTANTS

10       EOF
11
12               my $groups = $data{$class};
13               for my $group (sort keys %$groups) {
14                   print $fh <<"EOF";
15
16   ":$group"
17         use $class\::Const -compile qw(:$group);
18
19       The ":$group" group is for XXX constants.
20
21       EOF
22
23                   for my $const (sort @{ $groups->{$group} }) {
24                       print $fh "=head3 C<$class\::$const>\n\n\n";
25                   }
26               }
27
28               print $fh "=cut\n";
29           }
30       }
31
32       sub generate_constants_lookup_doc {
33           my ($data) = @_;
34
35           foreach my $class (sort keys %$Apache2::ConstantsTable) {
36               my $groups = $Apache2::ConstantsTable->{$class};
37               my $constants = [sort map { @$_ } values %$groups];
38
39               constants_lookup_code_doc($constants, $class, $data);
40           }
41       }
42
43       sub generate_constants_group_lookup_doc {
44           my ($data) = @_;
45
46           foreach my $class (sort keys %$Apache2::ConstantsTable) {
47               my $groups = $Apache2::ConstantsTable->{$class};
48               constants_group_lookup_code_doc($class, $groups, $data);
49           }
50       }
51
52       sub constants_group_lookup_code_doc {
53           my ($class, $groups, $data) = @_;
54           my @tags;
55           my @code;
56
57           while (my ($group, $constants) = each %$groups) {
58               $data->{$class}{$group} = [
59                   map {
60                       my @ifdef = constants_ifdef($_);
61                       s/^($constant_prefixes)_?//o;
62                       $seen_const{$class}{$_}++;
63                       $_;
64                   } @$constants
65               ];
66           }
67       }
68
69       sub constants_lookup_code_doc {
70           my ($constants, $class, $data) = @_;
71
72           my (%switch, %alias);
73
74           %alias = %shortcuts;
75
76           my $postfix = lc $class;
77           my $package = $class . '::';
78           my $package_len = length $package;
79
80           my $func = canon_func(qw(constants lookup), $postfix);
81
82           for (@$constants) {
83               if (s/^($constant_prefixes)(_)?//o) {
84                   $alias{$_} = join $2 || "", $1, $_;
85               }
86               else {
87                   $alias{$_} ||= $_;
88               }
89               next unless /^([A-Z])/;
90               push @{ $switch{$1} }, $_;
91           }
92
93           for my $key (sort keys %switch) {
94               my $names = $switch{$key};
95               for my $name (@$names) {
96                   my @ifdef = constants_ifdef($alias{$name});
97                   push @{ $data->{$class}{other} }, $name
98                       unless $seen_const{$class}{$name}
99               }
100           }
101       }
102
103       sub generate_exports {
104           my ($self, $c_fh) = @_;
105           require ModPerl::WrapXS;
106           ModPerl::WrapXS->generate_exports($c_fh); }
107
108       # src/modules/perl/*.c files needed to build APR/APR::* outside # of
109       mod_perl.so sub src_apr_ext {
110           return map { "modperl_$_" } (qw(error bucket),
111                                         map { "common_$_" } qw(util log)); }
112
113       1; __END__
114

NAME

116       ModPerl::Code - Generate mod_perl glue code
117

SYNOPSIS

119         use ModPerl::Code ();
120         my $code = ModPerl::Code->new;
121         $code->generate;
122

DESCRIPTION

124       This module provides functionality for generating mod_perl glue code.
125       Reason this code is generated rather than written by hand include:
126
127       consistency
128       thin and clean glue code
129       enable/disable features (without #ifdefs)
130       adapt to changes in Apache
131       experiment with different approaches to gluing
132

AUTHOR

134       Doug MacEachern
135
136
137
138perl v5.30.1                      2020-01-29                  ModPerl::Code(3)
Impressum