diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-03-26 22:24:13 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-03-27 08:18:22 -0400 |
commit | facde2a98f0b5f7689b4e30a9e7376e926e733b8 (patch) | |
tree | ab8b2cc1b2bd47b7db5e2def26d8eca4ce6ca438 /src/interfaces | |
parent | de4da168d57de812bb30d359394b7913635d21a9 (diff) |
Clean up Perl code according to perlcritic
Fix all perlcritic warnings of severity level 5, except in
src/backend/utils/Gen_dummy_probes.pl, which is automatically generated.
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/ecpg/preproc/check_rules.pl | 12 | ||||
-rw-r--r-- | src/interfaces/libpq/test/regress.pl | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl index dce4bc6a02f..e681943856b 100644 --- a/src/interfaces/ecpg/preproc/check_rules.pl +++ b/src/interfaces/ecpg/preproc/check_rules.pl @@ -53,8 +53,8 @@ my $comment = 0; my $non_term_id = ''; my $cc = 0; -open GRAM, $parser or die $!; -while (<GRAM>) +open my $parser_fh, '<', $parser or die $!; +while (<$parser_fh>) { if (/^%%/) { @@ -145,7 +145,7 @@ while (<GRAM>) } } -close GRAM; +close $parser_fh; if ($verbose) { print "$cc rules loaded\n"; @@ -154,8 +154,8 @@ if ($verbose) my $ret = 0; $cc = 0; -open ECPG, $filename or die $!; -while (<ECPG>) +open my $ecpg_fh, '<', $filename or die $!; +while (<$ecpg_fh>) { if (!/^ECPG:/) { @@ -170,7 +170,7 @@ while (<ECPG>) $ret = 1; } } -close ECPG; +close $ecpg_fh; if ($verbose) { diff --git a/src/interfaces/libpq/test/regress.pl b/src/interfaces/libpq/test/regress.pl index 1dab12282b8..c403130c6a7 100644 --- a/src/interfaces/libpq/test/regress.pl +++ b/src/interfaces/libpq/test/regress.pl @@ -14,19 +14,19 @@ my $expected_out = "$srcdir/$subdir/expected.out"; my $regress_out = "regress.out"; # open input file first, so possible error isn't sent to redirected STDERR -open(REGRESS_IN, "<", $regress_in) +open(my $regress_in_fh, "<", $regress_in) or die "can't open $regress_in for reading: $!"; # save STDOUT/ERR and redirect both to regress.out -open(OLDOUT, ">&", \*STDOUT) or die "can't dup STDOUT: $!"; -open(OLDERR, ">&", \*STDERR) or die "can't dup STDERR: $!"; +open(my $oldout_fh, ">&", \*STDOUT) or die "can't dup STDOUT: $!"; +open(my $olderr_fh, ">&", \*STDERR) or die "can't dup STDERR: $!"; open(STDOUT, ">", $regress_out) or die "can't open $regress_out for writing: $!"; open(STDERR, ">&", \*STDOUT) or die "can't dup STDOUT: $!"; # read lines from regress.in and run uri-regress on them -while (<REGRESS_IN>) +while (<$regress_in_fh>) { chomp; print "trying $_\n"; @@ -35,11 +35,11 @@ while (<REGRESS_IN>) } # restore STDOUT/ERR so we can print the outcome to the user -open(STDERR, ">&", \*OLDERR) or die; # can't complain as STDERR is still duped -open(STDOUT, ">&", \*OLDOUT) or die "can't restore STDOUT: $!"; +open(STDERR, ">&", $olderr_fh) or die; # can't complain as STDERR is still duped +open(STDOUT, ">&", $oldout_fh) or die "can't restore STDOUT: $!"; # just in case -close REGRESS_IN; +close $regress_in_fh; my $diff_status = system( "diff -c \"$srcdir/$subdir/expected.out\" regress.out >regress.diff"); |