1docs::api::ModPerl::MM(U3s)er Contributed Perl Documentatdioocns::api::ModPerl::MM(3)
2
3
4

NAME

6       ModPerl::MM -- A "subclass" of ExtUtils::MakeMaker for mod_perl 2.0
7

Synopsis

9         use ModPerl::MM;
10
11         # ModPerl::MM takes care of doing all the dirty job of overriding
12         ModPerl::MM::WriteMakefile(...);
13
14         # if there is a need to extend the default methods
15         sub MY::constants {
16             my $self = shift;
17             $self->ModPerl::MM::MY::constants;
18             # do something else;
19         }
20
21         # or prevent overriding completely
22         sub MY::constants { shift->MM::constants(@_); }";
23
24         # override the default value of WriteMakefile's attribute
25         my $extra_inc = "/foo/include";
26         ModPerl::MM::WriteMakefile(
27             ...
28             INC => $extra_inc,
29             ...
30         );
31
32         # extend the default value of WriteMakefile's attribute
33         my $extra_inc = "/foo/include";
34         ModPerl::MM::WriteMakefile(
35             ...
36             INC => join " ", $extra_inc, ModPerl::MM::get_def_opt('INC'),
37             ...
38         );
39

Description

41       "ModPerl::MM" is a "subclass" of "ExtUtils::MakeMaker" for mod_perl
42       2.0, to a degree of sub-classability of "ExtUtils::MakeMaker".
43
44       When ModPerl::MM::WriteMakefile() is used instead of
45       ExtUtils::MakeMaker::WriteMakefile(), "ModPerl::MM" overrides several
46       "ExtUtils::MakeMaker" methods behind the scenes and supplies default
47       WriteMakefile() arguments adjusted for mod_perl 2.0 build. It's written
48       in such a way so that normally 3rd party module developers for mod_perl
49       2.0, don't need to mess with Makefile.PL at all.
50

"MY::" Default Methods

52       "ModPerl::MM" overrides method foo as long as Makefile.PL hasn't
53       already specified a method MY::foo. If the latter happens,
54       "ModPerl::MM" will DWIM and do nothing.
55
56       In case the functionality of "ModPerl::MM" methods needs to be
57       extended, rather than completely overriden, the "ModPerl::MM" methods
58       can be called internally. For example if you need to modify constants
59       in addition to the modifications applied by
60       "ModPerl::MM::MY::constants", call the "ModPerl::MM::MY::constants"
61       method (notice that it resides in the package "ModPerl::MM::MY" and not
62       "ModPerl::MM"), then do your extra manipulations on constants:
63
64         # if there is a need to extend the methods
65         sub MY::constants {
66             my $self = shift;
67             $self->ModPerl::MM::MY::constants;
68             # do something else;
69         }
70
71       In certain cases a developers may want to prevent from "ModPerl::MM" to
72       override certain methods. In that case an explicit override in
73       Makefile.PL will do the job. For example if you don't want the
74       constants() method to be overriden by "ModPerl::MM", add to your
75       Makefile.PL:
76
77         sub MY::constants { shift->MM::constants(@_); }";
78
79       "ModPerl::MM" overrides the following methods:
80
81   "ModPerl::MM::MY::post_initialize"
82       This method is deprecated.
83

WriteMakefile() Default Arguments

85       "ModPerl::MM::WriteMakefile" supplies default arguments such as "INC"
86       and "TYPEMAPS" unless they weren't passed to
87       "ModPerl::MM::WriteMakefile" from Makefile.PL.
88
89       If the default values aren't satisfying these should be overriden in
90       Makefile.PL. For example to supply an empty INC, explicitly set the
91       argument in Makefile.PL.
92
93         ModPerl::MM::WriteMakefile(
94             ...
95             INC => '',
96             ...
97         );
98
99       If instead of fully overriding the default arguments, you want to
100       extend or modify them, they can be retrieved using the
101       ModPerl::MM::get_def_opt() function. The following example appends an
102       extra value to the default "INC" attribute:
103
104         my $extra_inc = "/foo/include";
105         ModPerl::MM::WriteMakefile(
106             ...
107             INC => join " ", $extra_inc, ModPerl::MM::get_def_opt('INC'),
108             ...
109         );
110
111       "ModPerl::MM" supplies default values for the following
112       "ModPerl::MM::WriteMakefile" attributes:
113
114   "CCFLAGS"
115   "LIBS"
116   "INC"
117   "OPTIMIZE"
118   "LDDLFLAGS"
119   "TYPEMAPS"
120   "dynamic_lib"
121       "OTHERLDFLAGS"
122
123         dynamic_lib => { OTHERLDFLAGS => ... }
124
125   "macro"
126       "MOD_INSTALL"
127
128         macro => { MOD_INSTALL => ... }
129
130       makes sure that Apache-Test/ is added to @INC.
131

Public API

133       The following functions are a part of the public API. They are
134       described elsewhere in this document.
135
136   WriteMakefile()
137         ModPerl::MM::WriteMakefile(...);
138
139   get_def_opt()
140         my $def_val = ModPerl::MM::get_def_opt($key);
141
142
143
144perl v5.36.0                      2023-01-19         docs::api::ModPerl::MM(3)
Impressum