.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Apache::TestMB 3pm" .TH Apache::TestMB 3pm "2021-05-21" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Apache::TestMB \- Subclass of Module::Build to support Apache::Test .SH "SYNOPSIS" .IX Header "SYNOPSIS" Standard process for building & installing modules: .PP .Vb 4 \& perl Build.PL \& ./Build \& ./Build test \& ./Build install .Ve .PP Or, if you're on a platform (like \s-1DOS\s0 or Windows) that doesn't like the \*(L"./\*(R" notation, you can do this: .PP .Vb 4 \& perl Build.PL \& perl Build \& perl Build test \& perl Build install .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class subclasses \f(CW\*(C`Module::Build\*(C'\fR to add support for testing Apache integration with Apache::Test. It is broadly based on \&\f(CW\*(C`Apache::TestMM\*(C'\fR, and as such adds a number of build actions to a the \&\fIBuild\fR script, while simplifying the process of creating \fIBuild.PL\fR scripts. .PP Here's how to use \f(CW\*(C`Apache::TestMB\*(C'\fR in a \fIBuild.PL\fR script: .PP .Vb 1 \& use Module::Build; \& \& my $build_pkg = eval { require Apache::TestMB } \& ? \*(AqApache::TestMB\*(Aq : \*(AqModule::Build\*(Aq; \& \& my $build = $build_pkg\->new( \& module_name => \*(AqMy::Module\*(Aq, \& ); \& $build\->create_build_script; .Ve .PP This is identical to how \f(CW\*(C`Module::Build\*(C'\fR is used. Not all target systems may have \f(CW\*(C`Apache::Test\*(C'\fR (and therefore \f(CW\*(C`Apache::TestMB\*(C'\fR installed, so we test for it to be installed, first. But otherwise, its use can be exactly the same. Consult the Module::Build documentation for more information on how to use it; Module::Build::Cookbook may be especially useful for those looking to migrate from \&\f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR. .SH "INTERFACE" .IX Header "INTERFACE" .SS "Build" .IX Subsection "Build" With the above script, users can build your module in the usual \&\f(CW\*(C`Module::Build\*(C'\fR way: .PP .Vb 4 \& perl Build.PL \& ./Build \& ./Build test \& ./Build install .Ve .PP If \f(CW\*(C`Apache::TestMB\*(C'\fR is installed, then Apache will be started before tests are run by the \f(CW\*(C`test\*(C'\fR action, and shut down when the tests complete. Note that \f(CW\*(C`Build.PL\*(C'\fR can be called \f(CW\*(C`Apache::Test\*(C'\fR\-specific options in addition to the usual \f(CW\*(C`Module::Build\*(C'\fR options. For example: .PP .Vb 1 \& perl Build.PL \-apxs /usr/local/apache/bin/apxs .Ve .PP Consult the Apache::Test documentation for a complete list of options. .PP In addition to the actions provided by \f(CW\*(C`Module::Build\*(C'\fR (\f(CW\*(C`build\*(C'\fR, \&\f(CW\*(C`clean\*(C'\fR, \f(CW\*(C`code\*(C'\fR, \f(CW\*(C`test\*(C'\fR, etc.), \f(CW\*(C`Apache::TestMB\*(C'\fR adds a few extra actions: .IP "test_clean" 4 .IX Item "test_clean" This action cleans out the files generated by the test script, \&\fIt/TEST\fR. It is also executed by the \f(CW\*(C`clean\*(C'\fR action. .IP "run_tests" 4 .IX Item "run_tests" This action actually the tests by executing the test script, \&\fIt/TEST\fR. It is executed by the \f(CW\*(C`test\*(C'\fR action, so most of the time it won't be executed directly. .IP "testcover" 4 .IX Item "testcover" \&\f(CW\*(C`Apache::TestMB\*(C'\fR overrides this action from \f(CW\*(C`Module::Build\*(C'\fR in order to prevent the \f(CW\*(C`Apache::Test\*(C'\fR preference files from being included in the test coverage. .SS "Constructor" .IX Subsection "Constructor" \fInew\fR .IX Subsection "new" .PP The \f(CW\*(C`new()\*(C'\fR constructor takes all the same arguments as its parent in \&\f(CW\*(C`Module::Build\*(C'\fR, but can optionally accept one other parameter: .IP "apache_test_script" 4 .IX Item "apache_test_script" The name of the \f(CW\*(C`Apache::Test\*(C'\fR test script. The default value is \&\fIt/TEST\fR, 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. .PP When \f(CW\*(C`new()\*(C'\fR is called it does the following: .IP "\(bu" 4 Processes the \f(CW\*(C`Apache::Test\*(C'\fR\-specific options in \f(CW@ARGV\fR. See the Apache::Test documentation for a complete list of options. .IP "\(bu" 4 Sets the name of the \f(CW\*(C`Apache::Test\*(C'\fR test script to \fIt/TEST\fR, unless it was explicitly specified by the \f(CW\*(C`apache_test_script\*(C'\fR parameter. .IP "\(bu" 4 Calls \f(CW\*(C`generate_script()\*(C'\fR to generate \f(CW\*(C`Apache::Test\*(C'\fR test script, usually \fIt/TEST\fR. .SS "Instance Methods" .IX Subsection "Instance Methods" \fIapache_test_args\fR .IX Subsection "apache_test_args" .PP Returns a hash reference containing all of the settings specified by options passed to \fIBuild.PL\fR, or explicitly added to \f(CW@ARGV\fR in \&\fIBuild.PL\fR. Consult the Apache::Test documentation for a complete list of options. .PP \fIapache_test_script\fR .IX Subsection "apache_test_script" .PP Gets or sets the file name of the \f(CW\*(C`Apache::Test\*(C'\fR test script. .PP \fIgenerate_script\fR .IX Subsection "generate_script" .PP .Vb 3 \& $build\->generate_script; \& $build\->generate_script(\*(Aqt/FOO\*(Aq); \& $build\->generate_script(undef, \*(AqApache::TestRun\*(Aq); .Ve .PP This method is called by \f(CW\*(C`new()\*(C'\fR, 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 \fIBuild.PL\fR and pass it the arguments you desire. It takes two optional arguments: .IP "\(bu" 4 The name of the \f(CW\*(C`Apache::Test\*(C'\fR test script. Defaults to the value returned by \f(CW\*(C`apache_test_script()\*(C'\fR. .IP "\(bu" 4 The name of an \f(CW\*(C`Apache::Test\*(C'\fR test running class. Defaults to \&\f(CW\*(C`Apache::TestRunPerl\*(C'\fR. .PP If there is an existing \fIt/TEST.PL\fR (or a script with the same name as specified by the \f(CW\*(C`apache_test_script\*(C'\fR parameter but with \fI.PL\fR 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 \f(CW\*(C`Apache::TestRun::generate_script()\*(C'\fR (although that function is not aware of the arguments passed to \&\fIBuild.PL\fR, so use this one instead!). .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "Apache::TestRequest" 4 .IX Item "Apache::TestRequest" Demonstrates how to write tests to send requests to the Apache server run by \f(CW\*(C`./Build test\*(C'\fR. .IP "Module::Build" 4 .IX Item "Module::Build" The parent class for \f(CW\*(C`Apache::TestMB\*(C'\fR; consult it's documentation for more on its interface. .IP "" 4 .IX Item "" This article by Geoffrey Young explains how to configure Apache and write tests for your module using Apache::Test. Just use \&\f(CW\*(C`Apache::TestMB\*(C'\fR instead of \f(CW\*(C`Apache::TestMM\*(C'\fR to update it for use with \f(CW\*(C`Module::Build\*(C'\fR. .SH "AUTHOR" .IX Header "AUTHOR" David Wheeler .PP Questions can be asked at the test-dev httpd.apache.org list. For more information see: \fIhttp://httpd.apache.org/test/\fR and \&\fIhttp://perl.apache.org/docs/general/testing/testing.html\fR.