Use merge_hashes rather than dclone
Tomas Doran [Mon, 22 Jun 2009 16:37:26 +0000 (16:37 +0000)]
Changes
lib/Catalyst/Component.pm

diff --git a/Changes b/Changes
index 5a5f47d..98c8727 100644 (file)
--- a/Changes
+++ b/Changes
@@ -6,6 +6,10 @@
            applications.
         -  Remove use of Test::MockObject as it doesn't install from CPAN
            in some environments.
+        -  Remove use of dclone to deep copy configs and replace with
+           Catalyst::Utils::merge_hashes which has the same effect, of
+           ensuring child classes don't inherit their parent's config,
+           except works correctly with closures.
 
 5.80005 2009-06-06 14:40:00
 
index f697072..f0a6d60 100644 (file)
@@ -8,7 +8,6 @@ use Class::C3::Adopt::NEXT;
 use MRO::Compat;
 use mro 'c3';
 use Scalar::Util 'blessed';
-use Storable 'dclone';
 use namespace::clean -except => 'meta';
 
 with 'MooseX::Emulate::Class::Accessor::Fast';
@@ -117,7 +116,9 @@ sub config {
         my $class = blessed($self) || $self;
         my $meta = Class::MOP::get_metaclass_by_name($class);
         unless ($meta->has_package_symbol('$_config')) {
-            $self->_config( dclone $config );
+            # Call merge_hashes to ensure we deep copy the parent
+            # config onto the subclass
+            $self->_config( Catalyst::Utils::merge_hashes($config, {}) );
         }
     }
     return $self->_config;