Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfacde2a

Browse files
committed
Clean up Perl code according to perlcritic
Fix all perlcritic warnings of severity level 5, except insrc/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>
1 parentde4da16 commitfacde2a

File tree

41 files changed

+360
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+360
-358
lines changed

‎contrib/intarray/bench/create_test.pl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
1616
EOT
1717

18-
open(MSG,">message.tmp") ||die;
19-
open(MAP,">message_section_map.tmp") ||die;
18+
open(my$msg,'>',"message.tmp") ||die;
19+
open(my$map,'>',"message_section_map.tmp") ||die;
2020

2121
srand(1);
2222

@@ -42,16 +42,16 @@
4242
}
4343
if ($#sect < 0 ||rand() < 0.1)
4444
{
45-
printMSG"$i\t\\N\n";
45+
print$msg"$i\t\\N\n";
4646
}
4747
else
4848
{
49-
printMSG"$i\t{" .join(',',@sect) ."}\n";
50-
map {printMAP"$i\t$_\n" }@sect;
49+
print$msg"$i\t{" .join(',',@sect) ."}\n";
50+
map {print$map"$i\t$_\n" }@sect;
5151
}
5252
}
53-
closeMAP;
54-
closeMSG;
53+
close$map;
54+
close$msg;
5555

5656
copytable('message');
5757
copytable('message_section_map');
@@ -79,8 +79,8 @@ sub copytable
7979
my$t =shift;
8080

8181
print"COPY$t from stdin;\n";
82-
open(FFF,"$t.tmp") ||die;
83-
while (<FFF>) {print; }
84-
closeFFF;
82+
open(my$fff,'<',"$t.tmp") ||die;
83+
while (<$fff>) {print; }
84+
close$fff;
8585
print"\\.\n";
8686
}

‎doc/src/sgml/generate-errcodes-table.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
print
1010
"<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
1111

12-
openmy$errcodes,$ARGV[0]ordie;
12+
openmy$errcodes,'<',$ARGV[0]ordie;
1313

1414
while (<$errcodes>)
1515
{

‎doc/src/sgml/mk_feature_tables.pl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
my$yesno =$ARGV[0];
88

9-
openPACK,$ARGV[1]ordie;
9+
openmy$pack,'<',$ARGV[1]ordie;
1010

1111
my%feature_packages;
1212

13-
while (<PACK>)
13+
while (<$pack>)
1414
{
1515
chomp;
1616
my ($fid,$pname) =split /\t/;
@@ -24,13 +24,13 @@
2424
}
2525
}
2626

27-
closePACK;
27+
close$pack;
2828

29-
openFEAT,$ARGV[2]ordie;
29+
openmy$feat,'<',$ARGV[2]ordie;
3030

3131
print"<tbody>\n";
3232

33-
while (<FEAT>)
33+
while (<$feat>)
3434
{
3535
chomp;
3636
my ($feature_id,$feature_name,$subfeature_id,
@@ -69,4 +69,4 @@
6969

7070
print"</tbody>\n";
7171

72-
closeFEAT;
72+
close$feat;

‎src/backend/catalog/Catalog.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ sub Catalogs
4444
$catalog{columns} = [];
4545
$catalog{data} = [];
4646

47-
open(INPUT_FILE,'<',$input_file) ||die"$input_file:$!";
47+
open(my$ifh,'<',$input_file) ||die"$input_file:$!";
4848

4949
my ($filename) = ($input_file =~m/(\w+)\.h$/);
5050
my$natts_pat ="Natts_$filename";
5151

5252
# Scan the input file.
53-
while (<INPUT_FILE>)
53+
while (<$ifh>)
5454
{
5555

5656
# Strip C-style comments.
@@ -59,7 +59,7 @@ sub Catalogs
5959
{
6060

6161
# handle multi-line comments properly.
62-
my$next_line = <INPUT_FILE>;
62+
my$next_line = <$ifh>;
6363
die"$input_file: ends within C-style comment\n"
6464
if !defined$next_line;
6565
$_ .=$next_line;
@@ -211,7 +211,7 @@ sub Catalogs
211211
}
212212
}
213213
$catalogs{$catname} = \%catalog;
214-
closeINPUT_FILE;
214+
close$ifh;
215215
}
216216
return \%catalogs;
217217
}

‎src/backend/catalog/genbki.pl

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@
6666
# Open temp files
6767
my$tmpext =".tmp$$";
6868
my$bkifile =$output_path .'postgres.bki';
69-
openBKI,'>',$bkifile .$tmpext
69+
openmy$bki,'>',$bkifile .$tmpext
7070
ordie"can't open$bkifile$tmpext:$!";
7171
my$schemafile =$output_path .'schemapg.h';
72-
openSCHEMAPG,'>',$schemafile .$tmpext
72+
openmy$schemapg,'>',$schemafile .$tmpext
7373
ordie"can't open$schemafile$tmpext:$!";
7474
my$descrfile =$output_path .'postgres.description';
75-
openDESCR,'>',$descrfile .$tmpext
75+
openmy$descr,'>',$descrfile .$tmpext
7676
ordie"can't open$descrfile$tmpext:$!";
7777
my$shdescrfile =$output_path .'postgres.shdescription';
78-
openSHDESCR,'>',$shdescrfile .$tmpext
78+
openmy$shdescr,'>',$shdescrfile .$tmpext
7979
ordie"can't open$shdescrfile$tmpext:$!";
8080

8181
# Fetch some special data that we will substitute into the output file.
@@ -97,7 +97,7 @@
9797
# Generate postgres.bki, postgres.description, and postgres.shdescription
9898

9999
# version marker for .bki file
100-
printBKI"# PostgreSQL$major_version\n";
100+
print$bki"# PostgreSQL$major_version\n";
101101

102102
# vars to hold data needed for schemapg.h
103103
my%schemapg_entries;
@@ -110,7 +110,7 @@
110110

111111
# .bki CREATE command for this catalog
112112
my$catalog =$catalogs->{$catname};
113-
printBKI"create$catname$catalog->{relation_oid}"
113+
print$bki"create$catname$catalog->{relation_oid}"
114114
.$catalog->{shared_relation}
115115
.$catalog->{bootstrap}
116116
.$catalog->{without_oids}
@@ -120,7 +120,7 @@
120120
my@attnames;
121121
my$first = 1;
122122

123-
printBKI" (\n";
123+
print$bki" (\n";
124124
foreachmy$column (@{$catalog->{columns} })
125125
{
126126
my$attname =$column->{name};
@@ -130,27 +130,27 @@
130130

131131
if (!$first)
132132
{
133-
printBKI" ,\n";
133+
print$bki" ,\n";
134134
}
135135
$first = 0;
136136

137-
printBKI"$attname =$atttype";
137+
print$bki"$attname =$atttype";
138138

139139
if (defined$column->{forcenotnull})
140140
{
141-
printBKI" FORCE NOT NULL";
141+
print$bki" FORCE NOT NULL";
142142
}
143143
elsif (defined$column->{forcenull})
144144
{
145-
printBKI" FORCE NULL";
145+
print$bki" FORCE NULL";
146146
}
147147
}
148-
printBKI"\n )\n";
148+
print$bki"\n )\n";
149149

150150
# open it, unless bootstrap case (create bootstrap does this automatically)
151151
if ($catalog->{bootstrap}eq'')
152152
{
153-
printBKI"open$catname\n";
153+
print$bki"open$catname\n";
154154
}
155155

156156
if (defined$catalog->{data})
@@ -175,17 +175,17 @@
175175

176176
# Write to postgres.bki
177177
my$oid =$row->{oid} ?"OID =$row->{oid}" :'';
178-
printfBKI"insert%s(%s)\n",$oid,$row->{bki_values};
178+
printf$bki"insert%s(%s)\n",$oid,$row->{bki_values};
179179

180180
# Write comments to postgres.description and postgres.shdescription
181181
if (defined$row->{descr})
182182
{
183-
printfDESCR"%s\t%s\t0\t%s\n",$row->{oid},$catname,
183+
printf$descr"%s\t%s\t0\t%s\n",$row->{oid},$catname,
184184
$row->{descr};
185185
}
186186
if (defined$row->{shdescr})
187187
{
188-
printfSHDESCR"%s\t%s\t%s\n",$row->{oid},$catname,
188+
printf$shdescr"%s\t%s\t%s\n",$row->{oid},$catname,
189189
$row->{shdescr};
190190
}
191191
}
@@ -267,7 +267,7 @@
267267
}
268268
}
269269

270-
printBKI"close$catname\n";
270+
print$bki"close$catname\n";
271271
}
272272

273273
# Any information needed for the BKI that is not contained in a pg_*.h header
@@ -276,19 +276,19 @@
276276
# Write out declare toast/index statements
277277
foreachmy$declaration (@{$catalogs->{toasting}->{data} })
278278
{
279-
printBKI$declaration;
279+
print$bki$declaration;
280280
}
281281

282282
foreachmy$declaration (@{$catalogs->{indexing}->{data} })
283283
{
284-
printBKI$declaration;
284+
print$bki$declaration;
285285
}
286286

287287

288288
# Now generate schemapg.h
289289

290290
# Opening boilerplate for schemapg.h
291-
printSCHEMAPG<<EOM;
291+
print$schemapg<<EOM;
292292
/*-------------------------------------------------------------------------
293293
*
294294
* schemapg.h
@@ -313,19 +313,19 @@
313313
# Emit schemapg declarations
314314
foreachmy$table_name (@tables_needing_macros)
315315
{
316-
printSCHEMAPG"\n#define Schema_$table_name\\\n";
317-
printSCHEMAPGjoin",\\\n", @{$schemapg_entries{$table_name} };
318-
printSCHEMAPG"\n";
316+
print$schemapg"\n#define Schema_$table_name\\\n";
317+
print$schemapgjoin",\\\n", @{$schemapg_entries{$table_name} };
318+
print$schemapg"\n";
319319
}
320320

321321
# Closing boilerplate for schemapg.h
322-
printSCHEMAPG"\n#endif /* SCHEMAPG_H */\n";
322+
print$schemapg"\n#endif /* SCHEMAPG_H */\n";
323323

324324
# We're done emitting data
325-
closeBKI;
326-
closeSCHEMAPG;
327-
closeDESCR;
328-
closeSHDESCR;
325+
close$bki;
326+
close$schemapg;
327+
close$descr;
328+
close$shdescr;
329329

330330
# Finally, rename the completed files into place.
331331
Catalog::RenameTempFile($bkifile,$tmpext);
@@ -425,7 +425,7 @@ sub bki_insert
425425
my@attnames =@_;
426426
my$oid =$row->{oid} ?"OID =$row->{oid}" :'';
427427
my$bki_values =join'',map$row->{$_},@attnames;
428-
printfBKI"insert%s(%s)\n",$oid,$bki_values;
428+
printf$bki"insert%s(%s)\n",$oid,$bki_values;
429429
}
430430

431431
# The field values of a Schema_pg_xxx declaration are similar, but not
@@ -472,15 +472,15 @@ sub find_defined_symbol
472472
}
473473
my$file =$path .$catalog_header;
474474
nextif !-f$file;
475-
open(FIND_DEFINED_SYMBOL,'<',$file) ||die"$file:$!";
476-
while (<FIND_DEFINED_SYMBOL>)
475+
open(my$find_defined_symbol,'<',$file) ||die"$file:$!";
476+
while (<$find_defined_symbol>)
477477
{
478478
if (/^#define\s+\Q$symbol\E\s+(\S+)/)
479479
{
480480
return$1;
481481
}
482482
}
483-
closeFIND_DEFINED_SYMBOL;
483+
close$find_defined_symbol;
484484
die"$file: no definition found for$symbol\n";
485485
}
486486
die"$catalog_header: not found in any include directory\n";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp