Apache::TestConfigPerl has this snippet:
$self->postamble($self->$container($module),
{ @args }) if @args;
now the array becomes hash so if there were two identical keys they get
smashed.
Now consider this __DATA__ section in test:
PerlSetVar Foo 1
PerlSetVar Bar 2
only Bar will enter httpd.conf :(
A possible workaround is to allow a hash of lists, so in
Apache::TestConfig::add_config, something list this happens.
if (ref($hash) eq 'HASH') {
for (keys %$hash){
my @values = ref ($hash->{$key}) eq 'ARRAY'
? @{ $hash->{$key} } : $hash->{$key};
for (@values){
# $key: write config line
}
}
now Apache::TestConfigPerl snippet from the top now cannot just squash
@args into a hash, but has to do:
my %hash;
while (@args)
my ($key, $val) = (shift @args, shift @args);
push @{ $hash{$key} }, $val;
}
and then pass \%hash.
Of course since add_config() now more flexible in what it gets, the last
snippet can be optimized to something like that:
if (exists $hash{$key} && !ref $hash{$key}) {
$old_val = delete $hash{$key};
push @{ $hash{$key} }, $old_val, $val;
}
else {
$hash{$key} = $val;
}
so if we have just a few places with more than one config directive of
the same name, this will take less space and time. not sure though if we
need it in the tests.
Disclaimer: the above code was written close to 5am, after desperately
trying to add dir_config() :) so please don't judge the style and I
won't be surprised if the code won't compile :)
Somebody will have to explain to me why this works (I can call
$r->dir_config):
mpxs_Apache__RequestRec_set_basic_credentials
mpxs_Apache__RequestRec_no_cache | | r, flag=Nullsv
PACKAGE=Apache::RequestRec
mpxs_Apache__RequestRec_dir_config
but this doesn't!
mpxs_Apache__RequestRec_set_basic_credentials
mpxs_Apache__RequestRec_no_cache | | r, flag=Nullsv
mpxs_Apache__RequestRec_dir_config
PACKAGE=Apache::RequestRec
after all no_cache and set_basic_credentials are exactly like dir_config
and even reside in the same .h file...
In the later case the server dies without spitting any error message and
not even segfault :( . That's why I was trying to use gdb, but could
figure out how to set the breakpoint (the code with the sub is not
loaded and that time).
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]