[Jifty-commit] r4357 - in jifty/trunk: .

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Nov 1 14:43:51 EDT 2007


Author: alexmv
Date: Thu Nov  1 14:43:51 2007
New Revision: 4357

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Param/Schema.pm

Log:
 r24273 at zoq-fot-pik:  chmrr | 2007-11-01 14:42:20 -0400
  * Horrible Hash::Merge workaround, part 2


Modified: jifty/trunk/lib/Jifty/Param/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Param/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Param/Schema.pm	Thu Nov  1 14:43:51 2007
@@ -172,18 +172,30 @@
 =cut
 
 sub merge_params {
-    my @merge = @_;
-
     # We pull this deref and re-ref trick to un-bless any
     # Jifty::Params which might exist; Hash::Merge pre-0.10 merged
-    # objects and hahrefs with no complaint, but 0.10 doesn't.
-    for my $m (@merge) {
-        $m->{$_} = {%{$m->{$_}}} for keys %{$m};
+    # objects and hahrefs with no complaint, but 0.10 doesn't.  This
+    # is a horrible, horrible hack, and will hopeflly be able to be
+    # backed out if and when Hash::Merge reverts to the old behavior.
+    my @types;
+    for my $m (@_) {
+        my @t;
+        for (keys %{$m}) {
+            push @t, ref $m->{$_};
+            bless $m->{$_}, "HASH";
+        }
+        push @types, \@t;
     }
     my $prev_behaviour = Hash::Merge::get_behavior();
     Hash::Merge::specify_behavior( MERGE_PARAM_BEHAVIOUR, "merge_params" );
-    my $rv = Hash::Merge::merge(@merge);
+    my $rv = Hash::Merge::merge(@_);
     Hash::Merge::set_behavior( $prev_behaviour );
+    for my $m (@_) {
+        my @t = @{shift @types};
+        for (keys %{$m}) {
+            bless $m->{$_}, shift @t;
+        }
+    }
     return $rv;
 }
 


More information about the Jifty-commit mailing list