s/snippets/captures/
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Component.pm
index feab1cf..1b601fe 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
 use NEXT;
 
-__PACKAGE__->mk_classdata($_) for qw/_config/;
+__PACKAGE__->mk_classdata($_) for qw/_config _plugins/;
 
 =head1 NAME
 
@@ -100,14 +100,15 @@ sub COMPONENT {
 
 sub config {
     my $self = shift;
-    $self->_config( {} ) unless $self->_config;
+    my $config = $self->_config;
+    unless ($config) {
+        $self->_config( $config = {} );
+    }
     if (@_) {
-        my $config = @_ > 1 ? {@_} : $_[0];
-        while ( my ( $key, $val ) = each %$config ) {
-            $self->_config->{$key} = $val;
-        }
+        $config = { %{$config}, %{@_ > 1 ? {@_} : $_[0]} };
+        $self->_config($config);
     }
-    return $self->_config;
+    return $config;
 }
 
 =head2 $c->process()