Skip to content

Commit a75b01c

Browse files
committed
Clear severity 5 perlcritic warnings from vcregress.pl
My recent update for python3 support used some idioms that are unapproved. This fixes them. Backpatch to all live branches like the original.
1 parent e7f9047 commit a75b01c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/tools/msvc/vcregress.pl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ sub mangle_plpython3
179179
my @files = glob("$dir/$test.$extension $dir/${test}_[0-9].$extension");
180180
foreach my $file (@files)
181181
{
182-
open(my $handle, "$file") || die "test file $file not found";
182+
open(my $handle, '<', $file) || die "test file $file not found";
183183
my $contents = <$handle>;
184184
close($handle);
185-
map
185+
do
186186
{
187187
s/except ([[:alpha:]][[:alpha:].]*), *([[:alpha:]][[:alpha:]]*):/except $1 as $2:/g;
188188
s/<type 'exceptions\.([[:alpha:]]*)'>/<class '$1'>/g;
@@ -194,15 +194,16 @@ sub mangle_plpython3
194194
s/LANGUAGE plpython2?u/LANGUAGE plpython3u/g;
195195
s/EXTENSION ([^ ]*_)*plpython2?u/EXTENSION $1plpython3u/g;
196196
s/installing required extension "plpython2u"/installing required extension "plpython3u"/g;
197-
} $contents;
197+
} for ($contents);
198198
my $base = basename $file;
199-
open($handle, ">$dir/python3/$base") || die "opening python 3 file for $file";
199+
open($handle, '>', "$dir/python3/$base") ||
200+
die "opening python 3 file for $file";
200201
print $handle $contents;
201202
close($handle);
202203
}
203204
}
204205
}
205-
map { $_ =~ s!^!python3/!; } @$tests;
206+
do { s!^!python3/!; } foreach(@$tests);
206207
return @$tests;
207208
}
208209

0 commit comments

Comments
 (0)