perlcritic
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Sep 2016 16:00:00 +0000 (12:00 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Sep 2016 16:00:00 +0000 (12:00 -0400)
wwwtools/nls-status-page
wwwtools/nls-status-table
wwwtools/pg-make-po

index f3cca0ec32d60e81cb77da2133ef324f15eae6a8..f33698f895f515493837206b479d5f33d6da0f96 100755 (executable)
@@ -89,9 +89,8 @@ my %branch_status = (
 
 my @branches = map { m!table-([^/]+).html$! && $1 } reverse sort glob("$dir/table-*.html");
 
-my ($b, $title);
-
-foreach $b (@branches) {
+foreach my $b (@branches) {
+    my $title;
     ($title = $b) =~ tr/-/ /;
     print "<li><a href='#t${b}-branch'>$title</a> &mdash; $branch_status{$b}</li>\n";
 }
@@ -111,13 +110,14 @@ print <<_EOF_;
 -->
 _EOF_
 
-foreach $b (@branches) {
+foreach my $b (@branches) {
+    my $title;
     ($title = $b) =~ tr/-/ /;
     print "<h2><a name='t${b}-branch'></a>", ucfirst($title), "</h2>\n";
 
-    open F, "$dir/table-${b}.html" or die $!;
-    print foreach <F>;
-    close F;
+    open my $f, '<', "$dir/table-${b}.html" or die $!;
+    print foreach <$f>;
+    close $f;
 
     print "<p><a href='qualified-list-$b.txt'>qualified list</a></p>\n" if -e "$dir/qualified-list-$b.txt";
 }
index c21dd8ef7ec3c3aebda89b48566a4b3612f5bd61..01b6485ef0e014d738f3496d036fec54f4342f56 100755 (executable)
@@ -1,10 +1,11 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
 
 # Prerequisites:
 # Input files given as argument (e.g., *.po)
 # set URL with -U option
 
 use strict;
+use warnings;
 
 use File::Basename;
 use Getopt::Std;
@@ -16,8 +17,8 @@ our $QUALIFIED_CUTOFF = 80;
 my %opts;
 getopts('U:l:', \%opts) or die;
 my $po_url = $opts{'U'} || 'po';
-my $list_file = $opts{'l'};
-open LIST, '>', $opts{'l'} if $list_file;
+my $list_filename = $opts{'l'};
+open my $list_fh, '>', $opts{'l'} if $list_filename;
 
 my $everything;
 my $errors;
@@ -147,7 +148,7 @@ foreach my $catalog (sort @catalogs) {
         }
         print "</td>\n";
 
-        print LIST "$catalog/$lang\n" if $list_file and defined $pct and $pct >= $QUALIFIED_CUTOFF;
+        print $list_fh "$catalog/$lang\n" if $list_filename and defined $pct and $pct >= $QUALIFIED_CUTOFF;
     }
 
     print "<td align=\"center\">";
@@ -182,7 +183,7 @@ print "</tr>\n\n";
 print "</table>\n";
 print "</div>\n";
 
-close LIST if $list_file;
+close $list_fh if $list_filename;
 
 sub list_sum {
     my $total;
index c0776abe6570277135f24d55d9689b3525c25f29..7aad4584cb93e931c8addc6ecab8f16671224664 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
 
 # Prerequisites:
 # GNU make (envar GMAKE)
@@ -10,6 +10,7 @@
 # Produces various output on stderr
 
 use strict;
+use warnings;
 
 use Getopt::Std;
 use File::Basename;
@@ -78,16 +79,15 @@ undef %saw;
 
 foreach (@ARGV) {
     my $dirname = dirname($_);
-    open NLSMK, "<$_" or die "could not open $_: $!\n";
+    open my $nlsmk, '<', $_ or die "could not open $_: $!\n";
 
     my $catalogname;
-    my $lang;
 
-    while (<NLSMK>) {
+    while (<$nlsmk>) {
         /^CATALOG_NAME\s*:?=\s*(\S+)\s*$/ and $catalogname = $1;
     }
 
-    close NLSMK;
+    close $nlsmk;
 
     system("$gmake -C $dirname init-po") == 0                                  or die "$!\n";
     system("cp -f $dirname/po/$catalogname.pot $outdir/$catalogname.pot") == 0 or die "$!\n";
@@ -95,7 +95,7 @@ foreach (@ARGV) {
     my $avail_languages = join(' ', map { m!/([^/]+)\.po$! && $1 } glob("$dirname/po/*.po"));
 
     print STDERR "* $catalogname\n";
-    foreach $lang (@all_languages) {
+    foreach my $lang (@all_languages) {
         print STDERR "$lang: ";
 
         system("rm -f $outdir/$catalogname-$lang.po.err");