stas        2002/12/04 20:56:15

  Modified:    t/response/TestDirective perlloadmodule2.pm
               .        Changes
  Log:
  explain why the deep copy is a must when objects include references
  
  Revision  Changes    Path
  1.2       +7 -9      modperl-2.0/t/response/TestDirective/perlloadmodule2.pm
  
  Index: perlloadmodule2.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perlloadmodule2.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- perlloadmodule2.pm        5 Dec 2002 03:31:09 -0000       1.1
  +++ perlloadmodule2.pm        5 Dec 2002 04:56:15 -0000       1.2
  @@ -23,19 +23,17 @@
   
   sub merge {
       my($base, $add) = @_;
  -    #use Data::Dumper;
  -    #warn Dumper $base, $add;
   
       my %new = ();
   
  -    push @{ $new{$_} }, @{ $base->{$_} } for keys %$base;
  +    # be careful if the object values are references and not scalars.
  +    # If that's the case a deep copy must be performed, or the merged
  +    # object will affect the based object, which will break things
  +    # when DIR_MERGE is called twice for the same $base/$add during
  +    # the same request
  +    push @{ $new{$_} }, @{ $base->{$_}||[] } for keys %$base;
  +    push @{ $new{$_} }, @{ $add->{$_} ||[]  } for keys %$add;
   
  -    # 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);
   }
   
  
  
  
  1.75      +7 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- Changes   4 Dec 2002 02:27:54 -0000       1.74
  +++ Changes   5 Dec 2002 04:56:15 -0000       1.75
  @@ -10,6 +10,13 @@
   
   =item 1.99_08-dev
   
  +add a new test TestDirective::perlloadmodule2, which performs a more
  +evolved merging.  [Stas Bekman]
  +
  +fix Apache::TestConfigPerl under mod_perl 1.0, need to require
  +mod_perl.pm before using $mod_perl::VERSION [Geoffrey Young
  +<[EMAIL PROTECTED]>]
  +
   add an Apache::SIG backcompat stub to Apache::compat [Stas Bekman]
   
   fix the Apache::TestConfigPerl's run_apache_test_config() function
  
  
  


Reply via email to