about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-10-12 13:16:38 +0530
committerAndinus <andinus@nand.sh>2020-10-12 13:16:38 +0530
commit5f2160451116bf2926be32c772c14aa2560c41b0 (patch)
tree362e18e6b6a8111196f0e62cbfaae5ea1d4edd76
parent9afdfbdd4963c10238bc26bdebabd875fbf9fdc5 (diff)
downloadleo-5f2160451116bf2926be32c772c14aa2560c41b0.tar.gz
Fix logical error, override local values correctly v0.1.1
-rwxr-xr-xleo.pl18
1 files changed, 11 insertions, 7 deletions
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