httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Apache::Test/mod_perl now can control the order of configuration insertion
Date Fri, 13 Dec 2002 10:42:54 GMT
I've just added a new feature to Apache::Test which provides a mechanism to 
control the order of configuration insertion. Here is what I'm going to add to 
the Apache::Test docs. I've already started using this feature in the mod_perl 
test suite.

=head3 Controlling the Configuration Order

Sometimes it's important in which order the configuration section of
each response package is inserted. C<Apache::Test> controls the
insertion order using a special token C<APACHE_TEST_CONFIG_ORDER>. To
decide on the configuration insertion order, C<Apache::Test> scans all
response packages and tries to match the following pattern:

   /APACHE_TEST_CONFIG_ORDER\s+([+-]?\d+)/

So you can assign any integer number (positive or negative). If the
match fails, it's assumed that the token's value is 0. Next a simple
numerical search is performed and those configuration sections with
lower token value are inserted first.

It's not specified how sections with the same token value are
ordered. This usually depends on the order the files were read from
the disk, which may vary from machine to machine and shouldn't be
relied upon.

As already mentioned by default all configuration sections have a
token whose value is 0, meaning that their ordering is
unimportant. Now if you want to make sure that some section is
inserted first, assign to it a negative number, e.g.:

   # APACHE_TEST_CONFIG_ORDER -150

Now if a new test is added and it has to be the first, add to this new
test a token with a negative value whose absolute value is higher than
C<-150>, e.g.:

   # APACHE_TEST_CONFIG_ORDER -151

or

   # APACHE_TEST_CONFIG_ORDER -500

Decide how big the gaps should be by thinking ahead. This is similar
to the Basic language line numbering ;) In any case, you can always
adjust other tests' token if you need to squeeze a number between two
consequent integers.

If on the other hand you want to ensure that some test is configured
last, use the highest positive number, e.g.:

   # APACHE_TEST_CONFIG_ORDER 100

If some other test needs to be configured just before the one we just
inserted, assign a token with a lower value, e.g.:

   # APACHE_TEST_CONFIG_ORDER 99



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message