libapa...erl::MM(3pm)
π NAME π
ModPerl::MM β a "subclass" of ExtUtils::MakeMaker for mod_perl 2.0. That's the manual libapa...erl::MM(3pm) bestie, and we're getting into it π
β¨ Synopsis β¨
use ModPerl::MM;
# ModPerl::MM takes care of doing all the dirty job of overriding
ModPerl::MM::WriteMakefile(...);
# if there is a need to extend the default methods
sub MY::constants {
my $self = shift;
$self->ModPerl::MM::MY::constants;
# do something else;
}
# or prevent overriding completely
sub MY::constants { shift->MM::constants(@_); }";
# override the default value of WriteMakefile's attribute
my $extra_inc = "/foo/include";
ModPerl::MM::WriteMakefile(
...
INC => $extra_inc,
...
);
# extend the default value of WriteMakefile's attribute
my $extra_inc = "/foo/include";
ModPerl::MM::WriteMakefile(
...
INC => join " ", $extra_inc, ModPerl::MM::get_def_opt('INC'),
...
);
ok but notice that stray "; hanging off the end of one of those subs? Yeah, it's in the original, we're keeping it, no cap π it's giving "copy-paste from a forum post circa 2007" and honestly? iconic.
πΈ Description πΈ
ModPerl::MM is a "subclass" of ExtUtils::MakeMaker for mod_perl 2.0 β but only to a degree of sub-classability of ExtUtils::MakeMaker. (Read that twice, it's load-bearing π)
So here's the tea β: when you call ModPerl::MM::WriteMakefile() instead of ExtUtils::MakeMaker::WriteMakefile(), ModPerl::MM slides in behind the scenes and overrides a whole bunch of ExtUtils::MakeMaker methods, plus it hands you default WriteMakefile() arguments that are already tuned for a mod_perl 2.0 build. The whole thing is written so that, normally, 3rd party module developers for mod_perl 2.0 don't need to mess with Makefile.PL at all. Not once. Not even a little. β¨
π¦ MY:: Default Methods π¦
So ModPerl::MM will override a method foo β but only as long as your Makefile.PL hasn't already specified a method MY::foo. If you already did that, ModPerl::MM will DWIM and do nothing at all. Respectful queen behavior π
But say you want to extend what ModPerl::MM does, not completely override it? The ModPerl::MM methods can be called internally, from inside your own. For example, if you need to modify constants on top of the modifications that ModPerl::MM::MY::constants already applies, you call the ModPerl::MM::MY::constants method β and heads up, it lives in the package ModPerl::MM::MY, not ModPerl::MM β then you do your extra manipulations on constants:
# if there is a need to extend the methods
sub MY::constants {
my $self = shift;
$self->ModPerl::MM::MY::constants;
# do something else;
}
And in certain cases a developer may want to prevent ModPerl::MM from overriding certain methods altogether. In that case, an explicit override in Makefile.PL does the job. For example, if you don't want the constants() method to be overridden by ModPerl::MM, add this to your Makefile.PL:
sub MY::constants { shift->MM::constants(@_); }";
ModPerl::MM overrides the following methods:
π ModPerl::MM::MY::post_initialize
This method is deprecated. π (rip, she's retired, don't build anything new on her)
π WriteMakefile() Default Arguments π
ModPerl::MM::WriteMakefile supplies default arguments like INC and TYPEMAPS β unless they weren't passed to ModPerl::MM::WriteMakefile from Makefile.PL. (Yep, that's exactly how it reads. The defaults fill in where nothing was passed.)
If the default values aren't satisfying π€ then you override them in Makefile.PL. For example, to supply an empty INC, explicitly set the argument in Makefile.PL:
ModPerl::MM::WriteMakefile(
...
INC => '',
...
);
But if instead of fully overriding the default arguments you want to extend or modify them, you can retrieve them with the ModPerl::MM::get_def_opt() function. The following example appends an extra value to the default INC attribute:
my $extra_inc = "/foo/include";
ModPerl::MM::WriteMakefile(
...
INC => join " ", $extra_inc, ModPerl::MM::get_def_opt('INC'),
...
);
And ModPerl::MM supplies default values for these ModPerl::MM::WriteMakefile attributes, babes:
CCFLAGSLIBSINCOPTIMIZELDDLFLAGSTYPEMAPSdynamic_libβ which is like:
dynamic_lib => { OTHERLDFLAGS => ... }
macroβ which is like:
macro => { MOD_INSTALL => ... }
and this one makes sure that Apache-Test/ is added to @INC. π«Ά
π Public API π
The following functions are a part of the public API β they're described elsewhere in this document, so no reruns, go read the sections above:
π WriteMakefile()
ModPerl::MM::WriteMakefile(...);
π get_def_opt()
my $def_val = ModPerl::MM::get_def_opt($key);
That's the whole thing, bestie β you now know ModPerl::MM better than the person who wrote your build system π§ and yes, this page is libapa...erl::MM(3pm) from perl v5.42.3, dated 2026-08-20. Slay, go write a Makefile.PL that just works. Periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: libapache2-mod-perl2 2.0.13-2build3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms