[Commits] [SCM] clawsker branch, master, updated. 1.3.8-11-g9e29274

mones at claws-mail.org mones at claws-mail.org
Wed Aug 28 15:18:35 UTC 2024


The branch, master has been updated
       via  9e2927444cbf017e9d060b0c0eb2d593945e85c3 (commit)
      from  1fcac46d828d1ccf9333feadbbae67090479d210 (commit)

Summary of changes:
 clawsker | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit 9e2927444cbf017e9d060b0c0eb2d593945e85c3
Author: Ricardo Mones <ricardo at mones.org>
Date:   Wed Aug 28 17:17:59 2024 +0200

    Don't use bareword filehandles

diff --git a/clawsker b/clawsker
index 087a320..354681e 100755
--- a/clawsker
+++ b/clawsker
@@ -2706,10 +2706,10 @@ sub load_resource {
     my %data = ();
     my %meta = ();
     my $line = 0;
-    open (RCF, '<:encoding(utf8)', $rc)
+    open (my $RCF, '<:encoding(utf8)', $rc)
         or die _("Error: opening '{file}' for reading", file => $rc) . ": $!\n";
     my $section = '_'; # default unnamed section
-    while (<RCF>) {
+    while (<$RCF>) {
         chomp;
         ++$line;
         next if (/^\s*$/);
@@ -2728,13 +2728,13 @@ sub load_resource {
             push (@{$data{$section}{'_'}}, $1);
         }
     }
-    close (RCF);
+    close ($RCF);
     return (\%data, \%meta);
 }
 
 sub save_resource {
     my ($rc, $data, $meta) = @_;
-    open (RCF, '>:utf8', $rc)
+    open (my $RCF, '>:utf8', $rc)
         or die _("Error: opening '{file}' for writing", file => $rc) . ": $!\n";
     my @sections = keys %$data;
     if (defined $meta) {
@@ -2743,10 +2743,10 @@ sub save_resource {
         } @sections
     }
     foreach my $section (@sections) {
-        say RCF "[$section]";
+        say $RCF "[$section]";
         if (ref ($data->{$section}{'_'}) eq 'ARRAY') {
             foreach my $val (@{$data->{$section}{'_'}}) {
-                say RCF $val;
+                say $RCF $val;
             }
             delete $data->{$section}{'_'};
         }
@@ -2758,11 +2758,11 @@ sub save_resource {
         }
         foreach my $key (@keys) {
             my $val = $data->{$section}{$key};
-            say RCF "$key=$val";
+            say $RCF "$key=$val";
         }
-        say RCF "";
+        say $RCF "";
     }
-    close (RCF);
+    close ($RCF);
 }
 
 sub backup_resource {
@@ -2780,11 +2780,11 @@ sub backup_resource {
 # specific loaders
 sub load_menurc {
     my $rc = shift;
-    open (RCF, '<:encoding(utf8)', $rc)
+    open (my $RCF, '<:encoding(utf8)', $rc)
         or die _("Error: opening '{file}' for reading", file => $rc) . ": $!\n";
     my %groups = ();
     my $line = 0;
-    while (<RCF>) {
+    while (<$RCF>) {
         chomp;
         if (/^; \(gtk_accel_path "<([A-Za-z]+)>([^"]+)" ([^\)]+)\)$/) {
             my %data = ('key' => $3, 'enabled' => FALSE, 'line' => $line);
@@ -2797,7 +2797,7 @@ sub load_menurc {
         }
         ++$line;
     }
-    close (RCF);
+    close ($RCF);
     return \%groups;
 }
 
@@ -2815,32 +2815,32 @@ sub save_menurc {
                     . $gkey . '>' . $akey . '" ' . $key . ')';
         }
     }
-    open (RCF, '>:utf8', $rc)
+    open (my $RCF, '>:utf8', $rc)
         or die _("Error: opening '{file}' for writing", file => $rc) . ": $!\n";
-    say RCF '; claws-mail GtkAccelMap rc-file         -*- scheme -*-';
-    say RCF '; this file is an automated accelerator map dump';
-    say RCF ';';
-    foreach (@lines) { say RCF $_ if $_ }
-    close (RCF);
+    say $RCF '; claws-mail GtkAccelMap rc-file         -*- scheme -*-';
+    say $RCF '; this file is an automated accelerator map dump';
+    say $RCF ';';
+    foreach (@lines) { say $RCF $_ if $_ }
+    close ($RCF);
 }
 
 # history files
 sub load_history {
     my $history = shift;
-    open (HIF, '<:encoding(utf8)', $history)
+    open (my $HIF, '<:encoding(utf8)', $history)
         or die _("Error: opening '{file}' for reading", file => $history) . ": $!\n";
     my @lines = ();
-    while (<HIF>) { chomp; s/^\s*//; push @lines, $_ if $_ }
-    close (HIF);
+    while (<$HIF>) { chomp; s/^\s*//; push @lines, $_ if $_ }
+    close ($HIF);
     return join("\n", @lines);
 }
 
 sub save_history {
     my ($history, $text) = @_;
-    open (HIF, '>:utf8', $history)
+    open (my $HIF, '>:utf8', $history)
         or die _("Error: opening '{file}' for writing", file => $history) . ": $!\n";
-    say HIF $text;
-    close (HIF);
+    say $HIF $text;
+    close ($HIF);
 }
 
 sub load_hi_preferences {

-----------------------------------------------------------------------


hooks/post-receive
-- 
Hidden preferences editor for Claws Mail


More information about the Commits mailing list