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