Apache::TestMB(3pm)
πΈ Apache::TestMB πΈ
ok so real talk bestie, this is Apache::TestMB(3pm), straight outta the User Contributed Perl Documentation pile π It's a subclass of Module::Build that makes your Apache::Test life so much easier. Let's get into it.
β¨ NAME β¨
Apache::TestMB β a subclass of Module::Build that supports Apache::Test. periodt.
π SYNOPSIS π
The standard glow-up process for building & installing modules, no notes:
perl Build.PL
./Build
./Build test
./Build install
Or, if you're on a platform that does not vibe with the ./ notation (looking at you, DOS and Windows π), you can do this instead:
perl Build.PL
perl Build
perl Build test
perl Build install
π¦ DESCRIPTION π¦
So this class subclasses Module::Build to add support for testing Apache integration with Apache::Test. It's broadly based on Apache::TestMM, and because of that it adds a bunch of build actions to the Build script while also simplifying the whole process of creating Build.PL scripts. it's giving convenience, honestly π
Here's how you use Apache::TestMB in a Build.PL script:
use Module::Build;
my $build_pkg = eval { require Apache::TestMB }
? 'Apache::TestMB' : 'Module::Build';
my $build = $build_pkg->new(
module_name => 'My::Module',
);
$build->create_build_script;
This is literally identical to how Module::Build is used. The thing is, not all target systems may have Apache::Test (and therefore Apache::TestMB) installed, so we test for it to be installed first. But otherwise, using it can be exactly the same. Consult the Module::Build documentation for more info on how to use it; Module::Build::Cookbook may be especially useful for those of you looking to migrate from ExtUtils::MakeMaker. π«Ά
π INTERFACE π
π Build
With the above script, users can build your module in the usual Module::Build way:
perl Build.PL
./Build
./Build test
./Build install
If Apache::TestMB is installed, then Apache will be started before tests are run by the test action, and shut down when the tests complete. iconic behavior honestly β¨
Note that Build.PL can be called with Apache::Test-specific options in addition to the usual Module::Build options. For example:
perl Build.PL -apxs /usr/local/apache/bin/apxs
Consult the Apache::Test documentation for a complete list of options. no cap.
In addition to the actions provided by Module::Build (build, clean, code, test, etc.), Apache::TestMB adds a few extra actions:
test_cleanβ this action cleans out the files generated by the test script,t/TEST. It is also executed by thecleanaction. π§Ήrun_testsβ this action actually the tests by executing the test script,t/TEST. It is executed by thetestaction, so most of the time it won't be executed directly. iykyk.testcoverβApache::TestMBoverrides this action fromModule::Buildin order to prevent theApache::Testpreference files from being included in the test coverage. protecting the vibe fr fr π
π Constructor
new
The new() constructor takes all the same arguments as its parent in Module::Build, but can optionally accept one other parameter:
apache_test_scriptβ the name of theApache::Testtest script. The default value ist/TEST, which will work in the vast majority of cases. If you wish to specify your own file name, do so with a relative file name using Unix-style paths; the file name will automatically be converted for the local platform. lowkey magic.
When new() is called it does the following:
- Processes the
Apache::Test-specific options in@ARGV. See the Apache::Test documentation for a complete list of options. - Sets the name of the
Apache::Testtest script tot/TEST, unless it was explicitly specified by theapache_test_scriptparameter. - Calls
generate_script()to generate theApache::Testtest script, usuallyt/TEST.
π Instance Methods
apache_test_args
Returns a hash reference containing all of the settings specified by options passed to Build.PL, or explicitly added to @ARGV in Build.PL. Consult the Apache::Test documentation for a complete list of options.
apache_test_script
Gets or sets the file name of the Apache::Test test script. simple as that bestie π
generate_script
$build->generate_script;
$build->generate_script('t/FOO');
$build->generate_script(undef, 'Apache::TestRun');
This method is called by new(), so in most cases it can be ignored. If you'd like it to use other than the default arguments, you can call it explicitly in Build.PL and pass it the arguments you desire. It takes two optional arguments:
- The name of the
Apache::Testtest script. Defaults to the value returned byapache_test_script(). - The name of an
Apache::Testtest running class. Defaults toApache::TestRunPerl.
If there is an existing t/TEST.PL (or a script with the same name as specified by the apache_test_script parameter but with .PL appended to it), then that script will be used as the template for the test script. Otherwise, a simple test script will be written similar to what would be written by Apache::TestRun::generate_script() (although that function is not aware of the arguments passed to Build.PL, so use this one instead!). π₯
π SEE ALSO π
Apache::TestRequestβ demonstrates how to write tests to send requests to the Apache server run by./Build test.Module::Buildβ the parent class forApache::TestMB; consult it's documentation for more on its interface.<http://www.perl.com/pub/a/2003/05/22/testing.html>β this article by Geoffrey Young explains how to configure Apache and write tests for your module using Apache::Test. Just useApache::TestMBinstead ofApache::TestMMto update it for use withModule::Build.
π AUTHOR π
David Wheeler
Questions can be asked at the test-dev <at> httpd.apache.org list. For more information see: http://httpd.apache.org/test/ and http://perl.apache.org/docs/general/testing/testing.html.
ok that's the whole page bestie, you ate that π β¨
perl v5.42.3 Β· 2026-08-20 Β· Apache::TestMB(3pm) β mwah, go build something cute π¦π
π¦ 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