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()