1Apache::TestConfig(3) User Contributed Perl DocumentationApache::TestConfig(3)
2
3
4
6 Apache::TestConfigData - Configuration file for Apache::Test
7
9 Apache::TestConfig -- Test Configuration setup module
10
12 use Apache::TestConfig;
13
14 my $cfg = Apache::TestConfig->new(%args)
15 my $fh = $cfg->genfile($file);
16 $cfg->writefile($file, $content);
17 $cfg->gendir($dir);
18 ...
19
21 "Apache::TestConfig" is used in creating the "Apache::Test" configura‐
22 tion files.
23
25 genwarning()
26 my $warn = $cfg->genwarning($filename)
27
28 genwarning() returns a warning string as a comment, saying that the
29 file was autogenerated and that it's not a good idea to modify this
30 file. After the warning a perl trace of calls to this this function
31 is appended. This trace is useful for finding what code has created
32 the file.
33
34 my $warn = $cfg->genwarning($filename, $from_filename)
35
36 If $from_filename is specified it'll be used in the warning to tell
37 which file it was generated from.
38
39 genwarning() automatically recognizes the comment type based on the
40 file extension. If the extension is not recognized, the default "#"
41 style is used.
42
43 Currently it support "<!-- -->", "/* ... */" and "#" styles.
44
45 genfile()
46 my $fh = $cfg->genfile($file);
47
48 genfile() creates a new file $file for writing and returns a file
49 handle.
50
51 If parent directories of $file don't exist they will be automagi‐
52 cally created.
53
54 The file $file and any created parent directories (if found empty)
55 will be automatically removed on cleanup.
56
57 A comment with a warning and calls trace is added to the top of
58 this file. See genwarning() for more info about this comment.
59
60 my $fh = $cfg->genfile($file, $from_file);
61
62 If $from_filename is specified it'll be used in the warning to tell
63 which file it was generated from.
64
65 my $fh = $cfg->genfile($file, $from_file, $nowarning);
66
67 If $nowarning is true, the warning won't be added. If using this
68 optional argument and there is no $from_file you must pass undef as
69 in:
70
71 my $fh = $cfg->genfile($file, undef, $nowarning);
72
73 writefile()
74 $cfg->writefile($file, $content, [$nowarning]);
75
76 writefile() creates a new file $file with the content of $content.
77
78 A comment with a warning and calls trace is added to the top of
79 this file unless $nowarnings is passed and set to a true value. See
80 genwarning() for more info about this comment.
81
82 If parent directories of $file don't exist they will be automagi‐
83 cally created.
84
85 The file $file and any created parent directories (if found empty)
86 will be automatically removed on cleanup.
87
88 write_perlscript()
89 $cfg->write_perlscript($filename, @lines);
90
91 Similar to writefile() but creates an executable Perl script with
92 correctly set shebang line.
93
94 gendir()
95 $cfg->gendir($dir);
96
97 gendir() creates a new directory $dir.
98
99 If parent directories of $dir don't exist they will be automagi‐
100 cally created.
101
102 The directory $dir and any created parent directories will be auto‐
103 matically removed on cleanup if found empty.
104
106 The following environment variables affect the configuration and the
107 run-time of the "Apache::Test" framework:
108
109 APACHE_TEST_COLOR
110
111 To aid visual control over the configuration process and the run-time
112 phase, "Apache::Test" uses coloured fonts when the environment variable
113 "APACHE_TEST_COLOR" is set to a true value.
114
115 APACHE_TEST_LIVE_DEV
116
117 When using "Apache::Test" during the project development phase, it's
118 often convenient to have the project/lib (live) directory appearing
119 first in @INC so any changes to the Perl modules, residing in it, imme‐
120 diately affect the server, without a need to rerun "make" to update
121 blib/lib. When the environment variable "APACHE_TEST_LIVE_DEV" is set
122 to a true value during the configuration phase ("t/TEST -config",
123 "Apache::Test" will automatically unshift the project/lib directory
124 into @INC, via the autogenerated t/conf/modperl_inc.pl file.
125
126 APACHE_TEST_INTERACTIVE_PROMPT_OK
127
128 Normally interactive prompts aren't run when STDIN is not attached to a
129 tty. But sometimes there is a program that can answer the prompts (e.g.
130 when testing A-T itself). If this variable is true the interactive con‐
131 fig won't be skipped (if needed).
132
134 When generating configuration files from the *.in templates, special
135 placeholder variables get substituted. To embed a placeholder use the
136 "@foo@" syntax. For example in extra.conf.in you can write:
137
138 Include @ServerRoot@/conf/myconfig.conf
139
140 When extra.conf is generated, "@ServerRoot@" will get replaced with the
141 location of the server root.
142
143 Placeholders are case-insensitive.
144
145 Available placeholders:
146
147 Configuration Options
148
149 All configuration variables that can be passed to "t/TEST", such as
150 "MaxClients", "DocumentRoot", "ServerRoot", etc. To see the complete
151 list run:
152
153 % t/TEST --help
154
155 and you will find them in the "configuration options" sections.
156
157 NextAvailablePort
158
159 Every time this placeholder is encountered it'll be replaced with the
160 next available port. This is very useful if you need to allocate a spe‐
161 cial port, but not hardcode it. Later when running:
162
163 % t/TEST -port=select
164
165 it's possible to run several concurrent test suites on the same
166 machine, w/o having port collisions.
167
170 perl(1), Apache::Test(3)
171
172
173
174perl v5.8.8 2006-11-19 Apache::TestConfig(3)