summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2017-01-22 02:41:51 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-23 10:56:23 -0800
commitb56867c9866bede78bed30373a193d9c7f2ce2d3 (patch)
tree4759064f1df7c6fa8a3bcef17fd217974e3ce5ca
parentDocumentation: fix warning in cat-texi.perl (diff)
downloadtgif-b56867c9866bede78bed30373a193d9c7f2ce2d3.tar.xz
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>
-rwxr-xr-xDocumentation/cat-texi.perl15
1 files changed, 9 insertions, 6 deletions
diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl
index b1fe52e8b9..1bc84d3c7c 100755
--- a/Documentation/cat-texi.perl
+++ b/Documentation/cat-texi.perl
@@ -1,9 +1,12 @@
#!/usr/bin/perl -w
+use strict;
+use warnings;
+
my @menu = ();
my $output = $ARGV[0];
-open TMP, '>', "$output.tmp";
+open my $tmp, '>', "$output.tmp";
while (<STDIN>) {
next if (/^\\input texinfo/../\@node Top/);
@@ -13,9 +16,9 @@ while (<STDIN>) {
}
s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//;
s/\@anchor\{[^{}]*\}//g;
- print TMP;
+ print $tmp $_;
}
-close TMP;
+close $tmp;
printf '\input texinfo
@setfilename gitman.info
@@ -34,10 +37,10 @@ for (@menu) {
print "* ${_}::\n";
}
print "\@end menu\n";
-open TMP, '<', "$output.tmp";
-while (<TMP>) {
+open $tmp, '<', "$output.tmp";
+while (<$tmp>) {
print;
}
-close TMP;
+close $tmp;
print "\@bye\n";
unlink "$output.tmp";