because ap_location_walk is called twice during the request, the DIR_MERGE is called twice as well. The problem I have is that in the following code $base magically gets affected by the return value from DIR_MERGE.

Consider:

sub DIR_MERGE {
my($base, $add) = @_;
use Data::Dumper;
warn Dumper $base, $add;

my %new = ();

#push @{ $new{$_} }, @{ $base->{$_} } for keys %$base;
# XXX: why this approach doesn't work?
@new{keys %$base} = (values %$base);

push @{ $new{$_} }, @{ $add->{$_}||[] } for keys %$add;

warn Dumper \%new;
return bless \%new, ref($base);
}

If I copy the values from %$base to %new via:

@new{keys %$base} = (values %$base);

when DIR_MERGE is called second time, %$base becomes %new from the first call. Only if I go and extract SVs one by one:

push @{ $new{$_} }, @{ $base->{$_} } for keys %$base;

$base doesn't get affected by %new.

See the new test TestDirectives/perlloadmodule2.pm for details, comment out the Dumper statements and see XXX.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to