From 5f2160451116bf2926be32c772c14aa2560c41b0 Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 12 Oct 2020 13:16:38 +0530 Subject: Fix logical error, override local values correctly --- leo.pl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'leo.pl') diff --git a/leo.pl b/leo.pl index 5b7a106..4b05e94 100755 --- a/leo.pl +++ b/leo.pl @@ -41,14 +41,18 @@ my %profile; foreach my $section (sort keys $config->%*) { next if $section eq "_"; - MAIN: foreach my $key (sort keys $config->{$section}->%*) { + + # Set global values to local profiles. + foreach (qw( encrypt sign )) { + $profile{$section}{$_} = $options{$_}; + } + + foreach my $key (sort keys $config->{$section}->%*) { # Override encrypt & sign options with local values. - foreach (qw( encrypt sign )) { - $profile{$section}{$_} = $options{$_}; - if ($key eq $_) { - $profile{$section}{$_} = $config->{$section}->{$key}; - next MAIN; - } + if ($key eq "encrypt" + or $key eq "sign") { + $profile{$section}{$key} = $config->{$section}->{$key}; + next; } push @{ $profile{$section}{exclude} }, $key and next -- cgit 1.4.1-2-gfad0