diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-08-15 11:00:27 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-08-15 11:00:27 +0300 |
commit | 35ca6e67bb06663f1c5cf1e4ceefaedf005bae80 (patch) | |
tree | e7a9e0c536e112ba4a699755ee208d258b61f0b2 | |
parent | 32ad59e0a9c7f74c7c094d5091bce435c145fe33 (diff) | |
download | acmeman-35ca6e67bb06663f1c5cf1e4ceefaedf005bae80.tar.gz acmeman-35ca6e67bb06663f1c5cf1e4ceefaedf005bae80.tar.bz2 |
Fix acmeman --setup
* acmeman: Unset core.source for setup
* lib/App/Acmeman/Config.pm (unset): New function.
-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}; |