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
49 special options like "PREFIX=/home/stas/perl". "Apache::Test" accepts a
50 lot of configuration options of its own. When
51 "Apache::TestMM::filter_args()" is called, it removes any
52 "Apache::Test"-specific options from @ARGV and stores them internally,
53 so when "WriteMakefile()" is called they aren't in @ARGV and thus won't
54 be processed by "WriteMakefile()".
55
56 The options can be set when Makefile.PL is called:
57
58 % perl Makefile.PL -apxs /path/to/apxs
59
60 Or you can push them manually to @ARGV from the code:
61
62 push @ARGV, '-apxs', $apxs_path;
63
64 When:
65
66 Apache::TestMM::generate_script('t/TEST');
67
68 is called, "Apache::Test"-specific options extracted by
69 "Apache::TestMM::filter_args()" are written to the autogenerated file.
70 In our example, the autogenerated t/TEST will include:
71
72 %Apache::TestConfig::Argv = qw(apxs /path/to/apxs);
73
74 which is going to be used by the "Apache::Test" runtime.
75
76 The other frequently used options are: "-httpd", telling where to find
77 the httpd (usually when the "-apxs" option is not used), "-libmodperl"
78 to use a specific mod_perl shared object (if your mod_perl is built as
79 DSO), "-maxclients" to change the default number of the configured
80 "MaxClients" directive, "-port" to start the server on a specific port,
81 etc. To get the complete list of available configuration options and
82 their purpose and syntax, run:
83
84 % perl -MApache::TestConfig -le 'Apache::TestConfig::usage()'
85
86 You may wish to document some of these in your application's README
87 file, especially the "-apxs" and "-httpd" options.
88
89 "generate_script"
90 Apache::TestMM::generate_script('t/TEST');
91
92 "generate_script()" accepts the name of the script to generate and will
93 look for a template with the same name and suffix .PL. So in our
94 example it'll look for t/TEST.PL. The autogenerated script t/TEST will
95 include the contents of t/TEST.PL, and special directives, including
96 any configuration options passed via "filter_args()" called from
97 Makefile.PL, special fixup code, etc.
98
99
100
101perl v5.12.0 2007-11-12 Apache::TestMM(3)