1Apache::TestMM(3) User Contributed Perl Documentation Apache::TestMM(3)
2
3
4
6 Apache::TestMM - Provide MakeMaker Wrapper Methods
7
9 require Apache::TestMM;
10
11 # import MY::test and MY::clean overrides for MM
12 Apache::TestMM->import(qw(test clean));
13
14 # parse command line args
15 Apache::TestMM::filter_args();
16
17 # autogenerate the script
18 Apache::TestMM::generate_script('t/TEST');
19
21 "Apache::TestMM" provides wrappers for the "ExtUtils::MakeMaker" craft,
22 making it easier to extend the autogenerated Makefile with
23 "Apache::Test".
24
26 "import"
27 use Apache::TestMM qw(test clean);
28
29 or:
30
31 Apache::TestMM->import(qw(test clean));
32
33 Imports "MY::" overrides for the default "ExtUtils::MakeMaker" test and
34 clean targets, as if you have defined:
35
36 sub MY::test {...}
37 sub MY::clean {...}
38
39 in Makefile.PL. "Apache::TestMM" does this for you so that these
40 Makefile targets will run the Apache server and the tests for it, and
41 clean up after its mess.
42
43 "filter_args"
44 push @ARGV, '-apxs', $apxs_path;
45 Apache::TestMM::filter_args();
46 WriteMakefile(...);
47
48 When WriteMakefile() is called it parses @ARGV, hoping to find special
49 options like "PREFIX=/home/stas/perl". "Apache::Test" accepts a lot of
50 configuration options of its own. When Apache::TestMM::filter_args() is
51 called, it removes any "Apache::Test"-specific options from @ARGV and
52 stores them internally, so when WriteMakefile() is called they aren't
53 in @ARGV and thus won't be processed by WriteMakefile().
54
55 The options can be set when Makefile.PL is called:
56
57 % perl Makefile.PL -apxs /path/to/apxs
58
59 Or you can push them manually to @ARGV from the code:
60
61 push @ARGV, '-apxs', $apxs_path;
62
63 When:
64
65 Apache::TestMM::generate_script('t/TEST');
66
67 is called, "Apache::Test"-specific options extracted by
68 Apache::TestMM::filter_args() are written to the autogenerated file. In
69 our example, the autogenerated t/TEST will include:
70
71 %Apache::TestConfig::Argv = qw(apxs /path/to/apxs);
72
73 which is going to be used by the "Apache::Test" runtime.
74
75 The other frequently used options are: "-httpd", telling where to find
76 the httpd (usually when the "-apxs" option is not used), "-libmodperl"
77 to use a specific mod_perl shared object (if your mod_perl is built as
78 DSO), "-maxclients" to change the default number of the configured
79 "MaxClients" directive, "-port" to start the server on a specific port,
80 etc. To get the complete list of available configuration options and
81 their purpose and syntax, run:
82
83 % perl -MApache::TestConfig -le 'Apache::TestConfig::usage()'
84
85 You may wish to document some of these in your application's README
86 file, especially the "-apxs" and "-httpd" options.
87
88 "generate_script"
89 Apache::TestMM::generate_script('t/TEST');
90
91 generate_script() accepts the name of the script to generate and will
92 look for a template with the same name and suffix .PL. So in our
93 example it'll look for t/TEST.PL. The autogenerated script t/TEST will
94 include the contents of t/TEST.PL, and special directives, including
95 any configuration options passed via filter_args() called from
96 Makefile.PL, special fixup code, etc.
97
98
99
100perl v5.36.0 2023-01-19 Apache::TestMM(3)