diff options
-rwxr-xr-x | acmeman | 1 | ||||
-rw-r--r-- | lib/App/Acmeman/Config.pm | 14 |
2 files changed, 15 insertions, 0 deletions
@@ -1190,6 +1190,7 @@ $config = new App::Acmeman::Config($config_file, if ($config->success) { if (my @source = $config->get(qw(core source))) { + $config->unset(qw(core source)); foreach my $s (@source) { my ($name, @args) = quotewords('\s+', 0, $s); my $pack = 'App::Acmeman::Source::' . ucfirst($name); diff --git a/lib/App/Acmeman/Config.pm b/lib/App/Acmeman/Config.pm index f566cb7..99b6aec 100644 --- a/lib/App/Acmeman/Config.pm +++ b/lib/App/Acmeman/Config.pm @@ -315,6 +315,20 @@ sub isset { return defined $self->_getref(@_); } +sub unset { + my $self = shift; + my $last = pop; + + return unless exists $self->{_conf}; + my $ref = $self->{_conf}; + for (@_) { + carp "component undefined" unless defined $_; + return unless exists $ref->{$_}; + $ref = $ref->{$_}; + } + delete $ref->{$last}; +} + sub set { my $self = shift; $self->{_conf} = {} unless exists $self->{_conf}; |