NAME
Apache::Bootstrap - Bootstraps dual life mod_perl1 and mod_perl2 Apache modules
SYNOPSIS
In your Makefile.PL
use Apache::Bootstrap 0.04;
my $bootstrap;
BEGIN {
# make sure we have at least one minimum version required
$bootstrap = Apache::Bootstrap->new({ mp2 => '1.99022', mp1 => 0, });
}
# write the Makefile using a mod_perl version dependent build subsystem
$bootstrap->WriteMakefile( %maker_options );
# check for Apache::Test, return the installed version if exists
my $has_apache_test = $bootstrap->check_for_apache_test();
# see if mod_perl2 is installed
my $mp_generation = $bootstrap->satisfy_mp_generation( 2 );
unless ($mp_generation) {
# no mod_perl2? look for mod_perl 1
$mp_generation = $bootstrap->satisfy_mp_generation( 1 );
}
# any mod_perl version will do
$mp_generation = Apache::Bootstrap->satisfy_mp_generation();
unless ( $mp_generation ) {
warn( 'No mod_perl installation was found' )
} else {
warn( "mod_perl generation $mp_generation was found" );
}
METHODS
new()
# try to find these versions of mod_perl, die if none are found
$bootstrap = Apache::Bootstrap->new({
mod_perl2 => 1.99022, # after mp2 renaming
mod_perl1 => 0, # any verison of mp1
});
mp_prereqs()
# returns the prerequisites for mod_perl versions in a hash reference
check_for_apache_test()
$apache_test_version = Apache::Bootstrap->check_for_apache_test;
Returns the version of Apache::Test installed. Returns undefined if Apache::Test is not installed.
satisfy_mp_generation()
# see if mod_perl2 is installed
my $mp_generation = Apache::Bootstrap->satisfy_mp_generation( 2 );
unless ($mp_generation) {
# no mod_perl2? look for mod_perl 1
$mp_generation = Apache::Bootstrap->satisfy_mp_generation( 1 );
}
# any mod_perl version will do
$mp_generation = Apache::Bootstrap->satisfy_mp_generation();
unless ( $mp_generation ) {
warn( 'No mod_perl installation was found' )
} else {
warn( "mod_perl generation $mp_generation was found" );
}
Currently the logic for determining the mod_perl generation is as follows.
# If a specific generation was passed as an argument,
# if satisfied
# return the same generation
# else
# die
# else @ARGV and %ENV will be checked for specific orders
# if the specification will be found
# if satisfied
# return the specified generation
# else
# die
# else if any mp generation is found
# return it
# else
# die
apache_major_version()
$apache_major_version = $bootstrap->apache_major_version;
The major version number of the target apache install
WriteMakefile()
$bootstrap->write_makefile( %makefile_options );
Writes the makefile using the appropriate make engine depending on what mod_perl version is in use. Same API as ExtUtils::MakeMaker or ModPerl::BuildMM
AUTHOR
Fred Moyer <fred@redhotpenguin.com>
The mod_perl development team <dev at perl.apache.org
> and numerous contributors.
This code was lifted from Apache::SizeLimit in an effort to make it useful to other modules such as Apache::Reload, Apache::Dispatch, any dual life Apache module.
BUGS
Please report bugs to the mod_perl development mailing list <dev at perl.apache.org
>.
COPYRIGHT & LICENSE
This is a derivative work of Apache::SizeLimit.
# Licensed to the Apache Software Foundation (ASF) under one or more # # contributor license agreements. See the NOTICE file distributed with # # this work for additional information regarding copyright ownership. # # The ASF licenses this file to You under the Apache License, Version 2.0 # # (the "License"); you may not use this file except in compliance with # # the License. You may obtain a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # # limitations under the License.