Documentation: modernize cat-texi.perl

Good style for Perl includes using the strict and warnings pragmas, and preferring lexical file handles over bareword file handles. Using lexical file handles necessitates being explicit when $_ is printed, so that Perl does not get confused and instead print the glob ref. The benefit of this modernization is that a formerly obscured bug is now visible, which will be fixed in a followup patch. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jan 22, 2017 at 02:41 UTC b56867c9866bede78bed30373a193d9c7f2ce2d3
1 file changed +9 -6
Documentation/cat-texi.perl
+9 -6
@@ -1,9 +1,12 @@
1 #!/usr/bin/perl -w
2
3 +use strict;
4 +use warnings;
5 +
6 my @menu = ();
7 my $output = $ARGV[0];
8
6 -open TMP, '>', "$output.tmp";
9 +open my $tmp, '>', "$output.tmp";
10
11 while (<STDIN>) {
12 next if (/^\\input texinfo/../\@node Top/);
@@ -13,9 +16,9 @@ while (<STDIN>) {
16 }
17 s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//;
18 s/\@anchor\{[^{}]*\}//g;
16 - print TMP;
19 + print $tmp $_;
20 }
18 -close TMP;
21 +close $tmp;
22
23 printf '\input texinfo
24 @setfilename gitman.info
@@ -34,10 +37,10 @@ for (@menu) {
37 print "* ${_}::\n";
38 }
39 print "\@end menu\n";
37 -open TMP, '<', "$output.tmp";
38 -while (<TMP>) {
40 +open $tmp, '<', "$output.tmp";
41 +while (<$tmp>) {
42 print;
43 }
41 -close TMP;
44 +close $tmp;
45 print "\@bye\n";
46 unlink "$output.tmp";