[Jifty-commit] r5942 - jifty/trunk/lib/Jifty/Param

Jifty commits jifty-commit at lists.jifty.org
Thu Oct 16 01:20:39 EDT 2008


Author: clkao
Date: Thu Oct 16 01:20:39 2008
New Revision: 5942

Modified:
   jifty/trunk/lib/Jifty/Param/Schema.pm

Log:
Skip merging super class action PARAMS if it's empty.


Modified: jifty/trunk/lib/Jifty/Param/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Param/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Param/Schema.pm	Thu Oct 16 01:20:39 2008
@@ -129,11 +129,19 @@
         $count += 10;
     }
 
-    if (my $super_params = $from->super('PARAMS')) {
-        $from->PARAMS(merge_params( $super_params->(), { @params } ));
+    if ( my $super_params = $from->super('PARAMS') ) {
+        my $super = $super_params->();
+        # XXX: skip the merge_params if the parent class' PARAMS is
+        # empty to avoid the currently kludgy merge_params
+        # implementation to pollute scalar::defer with undetermined
+        # behaviour
+        $from->PARAMS(
+            ($super && keys %$super)
+            ? merge_params( $super, {@params} )
+            : {@params} );
     }
     else {
-        $from->PARAMS({ @params });
+        $from->PARAMS( {@params} );
     }
 
     no strict 'refs';


More information about the Jifty-commit mailing list