mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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>
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
@ -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");
|
||||
|
Reference in New Issue
Block a user