I realized today that my latest version of Apache::Clean
for mod_perl 2.0 had a serious problem - it installed itself like any other module, under $Config{sitelib}/Apache/Clean.pm
.
while this may at first seem ok, mod_perl 2.0 has this strange ability to install itself under Apache2/
, so that if you
use Apache2 ();
mod_perl will look for stuff under $Config{sitelib}/Apache2/Apache/
. so, if the rest of the server is configured under Apache2
, installing this new package would still work, but it would clobber the existing Apache::Clean
in the mod_perl 1.0 installation. Of course, Apache::Clean
is just an example - this kind of stuff has to be figured out before we can expect people to start porting their modules over to mod_perl 2.0.
after a few hours of fighting with ExtUtils::MakeMaker
and pouring over the mod_perl 2.0 Makefile.PL
and other innards, I finally found a way to install relative to Apache/
or Apache2/
, depending on how mod_perl was built, that seems to work. it's even pretty simple (though not at all intuitive) once you know the magic formula. it looks something like
my %apache2 =
Apache::Build->build_config->{'MP_INST_APACHE2'}
? ( macro => { MOD_INSTALL => ModPerl::MM::mod_install(), }, )
: ();
*MY::constants = \&ModPerl::MM::MY::constants;
*MY::post_initialize = \&ModPerl::MM::MY::post_initialize;
WriteMakefile(
'NAME' => 'Apache::Clean',
'VERSION_FROM' => 'Clean.pm',
'PREREQ_PM' => {
'HTML::Clean' => 0.8,
mod_perl => 1.99
},
%apache2,
);
check out the latest version if you're interested in swiping the code.