Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

apache::testmm(3) [osx man page]

Apache::TestMM(3)					User Contributed Perl Documentation					 Apache::TestMM(3)

NAME
Apache::TestMM - Provide MakeMaker Wrapper Methods SYNOPSIS
require Apache::TestMM; # import MY::test and MY::clean overrides for MM Apache::TestMM->import(qw(test clean)); # parse command line args Apache::TestMM::filter_args(); # autogenerate the script Apache::TestMM::generate_script('t/TEST'); DESCRIPTION
"Apache::TestMM" provides wrappers for the "ExtUtils::MakeMaker" craft, making it easier to extend the autogenerated Makefile with "Apache::Test". FUNCTIONS
"import" use Apache::TestMM qw(test clean); or: Apache::TestMM->import(qw(test clean)); Imports "MY::" overrides for the default "ExtUtils::MakeMaker" test and clean targets, as if you have defined: sub MY::test {...} sub MY::clean {...} in Makefile.PL. "Apache::TestMM" does this for you so that these Makefile targets will run the Apache server and the tests for it, and clean up after its mess. "filter_args" push @ARGV, '-apxs', $apxs_path; Apache::TestMM::filter_args(); WriteMakefile(...); When "WriteMakefile()" is called it parses @ARGV, hoping to find special options like "PREFIX=/home/stas/perl". "Apache::Test" accepts a lot of configuration options of its own. When "Apache::TestMM::filter_args()" is called, it removes any "Apache::Test"-specific options from @ARGV and stores them internally, so when "WriteMakefile()" is called they aren't in @ARGV and thus won't be processed by "WriteMakefile()". The options can be set when Makefile.PL is called: % perl Makefile.PL -apxs /path/to/apxs Or you can push them manually to @ARGV from the code: push @ARGV, '-apxs', $apxs_path; When: Apache::TestMM::generate_script('t/TEST'); is called, "Apache::Test"-specific options extracted by "Apache::TestMM::filter_args()" are written to the autogenerated file. In our example, the autogenerated t/TEST will include: %Apache::TestConfig::Argv = qw(apxs /path/to/apxs); which is going to be used by the "Apache::Test" runtime. The other frequently used options are: "-httpd", telling where to find the httpd (usually when the "-apxs" option is not used), "-libmodperl" to use a specific mod_perl shared object (if your mod_perl is built as DSO), "-maxclients" to change the default number of the configured "MaxClients" directive, "-port" to start the server on a specific port, etc. To get the complete list of available configuration options and their purpose and syntax, run: % perl -MApache::TestConfig -le 'Apache::TestConfig::usage()' You may wish to document some of these in your application's README file, especially the "-apxs" and "-httpd" options. "generate_script" Apache::TestMM::generate_script('t/TEST'); "generate_script()" accepts the name of the script to generate and will look for a template with the same name and suffix .PL. So in our example it'll look for t/TEST.PL. The autogenerated script t/TEST will include the contents of t/TEST.PL, and special directives, including any configuration options passed via "filter_args()" called from Makefile.PL, special fixup code, etc. perl v5.16.2 2011-02-07 Apache::TestMM(3)

Check Out this Related Man Page

Apache::TestMB(3)					User Contributed Perl Documentation					 Apache::TestMB(3)

NAME
Apache::TestMB - Subclass of Module::Build to support Apache::Test SYNOPSIS
Standard process for building & installing modules: perl Build.PL ./Build ./Build test ./Build install Or, if you're on a platform (like DOS or Windows) that doesn't like the "./" notation, you can do this: perl Build.PL perl Build perl Build test perl Build install DESCRIPTION
This class subclasses "Module::Build" to add support for testing Apache integration with Apache::Test. It is broadly based on "Apache::TestMM", and as such adds a number of build actions to a the Build script, while simplifying the process of creating Build.PL scripts. Here's how to 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 identical to how "Module::Build" is used. Not all target systems may have "Apache::Test" (and therefore "Apache::TestMB" 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 "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. Note that "Build.PL" can be called "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. 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 the "clean" action. run_tests This action actually the tests by executing the test script, t/TEST. It is executed by the "test" action, so most of the time it won't be executed directly. testcover "Apache::TestMB" overrides this action from "Module::Build" in order to prevent the "Apache::Test" preference files from being included in the test coverage. 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 the "Apache::Test" test script. The default value is t/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. When "new()" is called it does the following: o Processes the "Apache::Test"-specific options in @ARGV. See the Apache::Test documentation for a complete list of options. o Sets the name of the "Apache::Test" test script to t/TEST, unless it was explicitly specified by the "apache_test_script" parameter. o Calls "generate_script()" to generate "Apache::Test" test script, usually t/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. 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: o The name of the "Apache::Test" test script. Defaults to the value returned by "apache_test_script()". o The name of an "Apache::Test" test running class. Defaults to "Apache::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 for "Apache::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 use "Apache::TestMB" instead of "Apache::TestMM" to update it for use with "Module::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. perl v5.12.1 2007-12-31 Apache::TestMB(3)
Man Page