1Apache::TestConfig(3) User Contributed Perl DocumentationApache::TestConfig(3)
2
3
4

NAME

6       Apache::TestConfig -- Test Configuration setup module
7

SYNOPSIS

9         use Apache::TestConfig;
10
11         my $cfg = Apache::TestConfig->new(%args)
12         my $fh = $cfg->genfile($file);
13         $cfg->writefile($file, $content);
14         $cfg->gendir($dir);
15         ...
16

DESCRIPTION

18       "Apache::TestConfig" is used in creating the "Apache::Test"
19       configuration files.
20

FUNCTIONS

22       genwarning()
23             my $warn = $cfg->genwarning($filename)
24
25           genwarning() returns a warning string as a comment, saying that the
26           file was autogenerated and that it's not a good idea to modify this
27           file. After the warning a perl trace of calls to this this function
28           is appended. This trace is useful for finding what code has created
29           the file.
30
31             my $warn = $cfg->genwarning($filename, $from_filename)
32
33           If $from_filename is specified it'll be used in the warning to tell
34           which file it was generated from.
35
36           genwarning() automatically recognizes the comment type based on the
37           file extension. If the extension is not recognized, the default "#"
38           style is used.
39
40           Currently it support "<!-- -->", "/* ... */" and "#" styles.
41
42       genfile()
43             my $fh = $cfg->genfile($file);
44
45           genfile() creates a new file $file for writing and returns a file
46           handle.
47
48           If parent directories of $file don't exist they will be
49           automagically created.
50
51           The file $file and any created parent directories (if found empty)
52           will be automatically removed on cleanup.
53
54           A comment with a warning and calls trace is added to the top of
55           this file. See genwarning() for more info about this comment.
56
57             my $fh = $cfg->genfile($file, $from_file);
58
59           If $from_filename is specified it'll be used in the warning to tell
60           which file it was generated from.
61
62             my $fh = $cfg->genfile($file, $from_file, $nowarning);
63
64           If $nowarning is true, the warning won't be added. If using this
65           optional argument and there is no $from_file you must pass undef as
66           in:
67
68             my $fh = $cfg->genfile($file, undef, $nowarning);
69
70       writefile()
71             $cfg->writefile($file, $content, [$nowarning]);
72
73           writefile() creates a new file $file with the content of $content.
74
75           A comment with a warning and calls trace is added to the top of
76           this file unless $nowarnings is passed and set to a true value. See
77           genwarning() for more info about this comment.
78
79           If parent directories of $file don't exist they will be
80           automagically created.
81
82           The file $file and any created parent directories (if found empty)
83           will be automatically removed on cleanup.
84
85       write_perlscript()
86             $cfg->write_perlscript($filename, @lines);
87
88           Similar to writefile() but creates an executable Perl script with
89           correctly set shebang line.
90
91       gendir()
92             $cfg->gendir($dir);
93
94           gendir() creates a new directory $dir.
95
96           If parent directories of $dir don't exist they will be
97           automagically created.
98
99           The directory $dir and any created parent directories will be
100           automatically removed on cleanup if found empty.
101

Environment Variables

103       The following environment variables affect the configuration and the
104       run-time of the "Apache::Test" framework:
105
106   APACHE_TEST_COLOR
107       To aid visual control over the configuration process and the run-time
108       phase, "Apache::Test" uses coloured fonts when the environment variable
109       "APACHE_TEST_COLOR" is set to a true value.
110
111   APACHE_TEST_LIVE_DEV
112       When using "Apache::Test" during the project development phase, it's
113       often convenient to have the project/lib (live) directory appearing
114       first in @INC so any changes to the Perl modules, residing in it,
115       immediately affect the server, without a need to rerun "make" to update
116       blib/lib. When the environment variable "APACHE_TEST_LIVE_DEV" is set
117       to a true value during the configuration phase ("t/TEST -config",
118       "Apache::Test" will automatically unshift the project/lib directory
119       into @INC, via the autogenerated t/conf/modperl_inc.pl file.
120

Special Placeholders

122       When generating configuration files from the *.in templates, special
123       placeholder variables get substituted. To embed a placeholder use the
124       "@foo@" syntax. For example in extra.conf.in you can write:
125
126         Include @ServerRoot@/conf/myconfig.conf
127
128       When extra.conf is generated, "@ServerRoot@" will get replaced with the
129       location of the server root.
130
131       Placeholders are case-insensitive.
132
133       Available placeholders:
134
135   Configuration Options
136       All configuration variables that can be passed to "t/TEST", such as
137       "MaxClients", "DocumentRoot", "ServerRoot", etc. To see the complete
138       list run:
139
140         % t/TEST --help
141
142       and you will find them in the "configuration options" sections.
143
144   NextAvailablePort
145       Every time this placeholder is encountered it'll be replaced with the
146       next available port. This is very useful if you need to allocate a
147       special port, but not hardcode it. Later when running:
148
149         % t/TEST -port=select
150
151       it's possible to run several concurrent test suites on the same
152       machine, w/o having port collisions.
153

AUTHOR

SEE ALSO

156       perl(1), Apache::Test(3)
157
158
159
160perl v5.32.1                      2021-01-26             Apache::TestConfig(3)
Impressum