{"thread":{"id":"5085","subject":"[PATCH 10/10] Fix perl scripts to work with version 5.005_03.","startedAt":"2006-08-02T01:03:49Z","lastAt":"2006-08-02T01:03:49Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"24542","messageId":"00c601c6b5cf$83a627c0$c47eedc1@ramsay1.demon.co.uk","threadId":"5085","inReplyTo":null,"subject":"[PATCH 10/10] Fix perl scripts to work with version 5.005_03.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-02T01:03:49Z","receivedAt":"2006-08-02T01:03:49Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"In order to make git work on an ancient Linux (Mandrake 7.0) we\nneed to make the perl scripts work with verion 5.005_03.\n\nThe changes include:\n\n  - comment out the \"use warnings\" pragma\n  - open has only two arguments; eg. `open FH, \"<$file\"` rather\n    than `open FH, '<', $file`\n  - replace \"our\" with \"my\" in the declaration of global (package)\n    variables.\n  - replace the use of some indirect file-handles with regular\n    file-handles.\n\nNote that only those perl scripts which are exercised by the test\nsuite or that I have called directly have been modified.\n\nSigned-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n Documentation/build-docdep.perl |    2 +-\n git-annotate.perl               |   25 ++++++++++++-------------\n git-clone.sh                    |    6 +++---\n git-mv.perl                     |    4 ++--\n git-send-email.perl             |   27 +++++++++++++--------------\n git-shortlog.perl               |    2 +-\n 6 files changed, 32 insertions(+), 34 deletions(-)\n\ndiff --git a/Documentation/build-docdep.perl\nb/Documentation/build-docdep.perl\nindex 489389c..cd40f56 100755\n--- a/Documentation/build-docdep.perl\n+++ b/Documentation/build-docdep.perl\n@@ -4,7 +4,7 @@ my %include = ();\n my %included = ();\n\n for my $text (<*.txt>) {\n-    open I, '<', $text || die \"cannot read: $text\";\n+    open I, \"<$text\" || die \"cannot read: $text\";\n     while (<I>) {\n \tif (/^include::/) {\n \t    chomp;\ndiff --git a/git-annotate.perl b/git-annotate.perl\nindex a6a7a48..629f480 100755\n--- a/git-annotate.perl\n+++ b/git-annotate.perl\n@@ -6,7 +6,7 @@ #\n # This file is licensed under the GPL v2, or a later version\n # at the discretion of Linus Torvalds.\n\n-use warnings;\n+#use warnings;\n use strict;\n use Getopt::Long;\n use POSIX qw(strftime gmtime);\n@@ -29,7 +29,7 @@ sub usage() {\n \texit(1);\n }\n\n-our ($help, $longrev, $rename, $rawtime, $starting_rev, $rev_file) = (0, 0,\n1);\n+my ($help, $longrev, $rename, $rawtime, $starting_rev, $rev_file) = (0, 0,\n1);\n\n my $rc = GetOptions(\t\"long|l\" => \\$longrev,\n \t\t\t\"time|t\" => \\$rawtime,\n@@ -52,12 +52,12 @@ my @stack = (\n \t},\n );\n\n-our @filelines = ();\n+my @filelines = ();\n\n if (defined $starting_rev) {\n \t@filelines = git_cat_file($starting_rev, $filename);\n } else {\n-\topen(F,\"<\",$filename)\n+\topen(F,\"<$filename\")\n \t\tor die \"Failed to open filename: $!\";\n\n \twhile(<F>) {\n@@ -68,9 +68,9 @@ if (defined $starting_rev) {\n\n }\n\n-our %revs;\n-our @revqueue;\n-our $head;\n+my %revs;\n+my @revqueue;\n+my $head;\n\n my $revsprocessed = 0;\n while (my $bound = pop @stack) {\n@@ -436,14 +436,13 @@ sub format_date {\n # Copied from git-send-email.perl - We need a Git.pm module..\n sub gitvar {\n     my ($var) = @_;\n-    my $fh;\n-    my $pid = open($fh, '-|');\n+    my $pid = open(FH, '-|');\n     die \"$!\" unless defined $pid;\n     if (!$pid) {\n \texec('git-var', $var) or die \"$!\";\n     }\n-    my ($val) = <$fh>;\n-    close $fh or die \"$!\";\n+    my ($val) = <FH>;\n+    close FH or die \"$!\";\n     chomp($val);\n     return $val;\n }\n@@ -471,7 +470,7 @@ sub open_pipe_activestate {\n sub open_pipe_normal {\n \tmy (@execlist) = @_;\n\n-\tmy $pid = open my $kid, \"-|\";\n+\tmy $pid = open KID, \"-|\";\n \tdefined $pid or die \"Cannot fork: $!\";\n\n \tunless ($pid) {\n@@ -479,7 +478,7 @@ sub open_pipe_normal {\n \t\tdie \"Cannot exec @execlist: $!\";\n \t}\n\n-\treturn $kid;\n+\treturn *KID;\n }\n\n package Git::ActiveStatePipe;\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 47bd8e7..430c892 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -71,17 +71,17 @@ sub store {\n \tmy ($sha1, $name, $top) = @_;\n \t$name = \"$git_dir/refs/$top/$name\";\n \tmkpath(dirname($name));\n-\topen O, \">\", \"$name\";\n+\topen O, \">$name\";\n \tprint O \"$sha1\\n\";\n \tclose O;\n }\n\n-open FH, \"<\", \"$git_dir/CLONE_HEAD\";\n+open FH, \"<$git_dir/CLONE_HEAD\";\n while (<FH>) {\n \tmy ($sha1, $name) = /^([0-9a-f]{40})\\s(.*)$/;\n \tnext if ($name =~ /\\^\\173/);\n \tif ($name eq \"HEAD\") {\n-\t\topen O, \">\", \"$git_dir/REMOTE_HEAD\";\n+\t\topen O, \">$git_dir/REMOTE_HEAD\";\n \t\tprint O \"$sha1\\n\";\n \t\tclose O;\n \t\tnext;\ndiff --git a/git-mv.perl b/git-mv.perl\nindex 75aa8fe..7aceeb8 100755\n--- a/git-mv.perl\n+++ b/git-mv.perl\n@@ -7,7 +7,7 @@ # This file is licensed under the GPL v2\n # at the discretion of Linus Torvalds.\n\n\n-use warnings;\n+#use warnings;\n use strict;\n use Getopt::Std;\n\n@@ -19,7 +19,7 @@ EOT\n \texit(1);\n }\n\n-our ($opt_n, $opt_f, $opt_h, $opt_k, $opt_v);\n+my ($opt_n, $opt_f, $opt_h, $opt_k, $opt_v);\n getopts(\"hnfkv\") || usage;\n usage() if $opt_h;\n @ARGV >= 1 or usage;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex c5d9e73..e670f28 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -17,7 +17,7 @@ #    and second line is the subject of t\n #\n\n use strict;\n-use warnings;\n+#use warnings;\n use Term::ReadLine;\n use Getopt::Long;\n use Data::Dumper;\n@@ -83,14 +83,13 @@ # Now, let's fill any that aren't set in\n\n sub gitvar {\n     my ($var) = @_;\n-    my $fh;\n-    my $pid = open($fh, '-|');\n+    my $pid = open(FH, '-|');\n     die \"$!\" unless defined $pid;\n     if (!$pid) {\n \texec('git-var', $var) or die \"$!\";\n     }\n-    my ($val) = <$fh>;\n-    close $fh or die \"$!\";\n+    my ($val) = <FH>;\n+    close FH or die \"$!\";\n     chomp($val);\n     return $val;\n }\n@@ -134,7 +133,7 @@ my %parse_alias = (\n\n if (@alias_files && defined $parse_alias{$aliasfiletype}) {\n \tforeach my $file (@alias_files) {\n-\t\topen my $fh, '<', $file or die \"opening $file: $!\\n\";\n+\t\topen my $fh, \"<$file\" or die \"opening $file: $!\\n\";\n \t\t$parse_alias{$aliasfiletype}->($fh);\n \t\tclose $fh;\n \t}\n@@ -209,7 +208,7 @@ if (!$smtp_server) {\n if ($compose) {\n \t# Note that this does not need to be secure, but we will make a small\n \t# effort to have it be unique\n-\topen(C,\">\",$compose_filename)\n+\topen(C,\">$compose_filename\")\n \t\tor die \"Failed to open for writing $compose_filename: $!\";\n \tprint C \"From $from # This line is ignored.\\n\";\n \tprintf C \"Subject: %s\\n\\n\", $initial_subject;\n@@ -226,10 +225,10 @@ EOT\n \t$editor = 'vi' unless defined $editor;\n \tsystem($editor, $compose_filename);\n\n-\topen(C2,\">\",$compose_filename . \".final\")\n+\topen(C2,\">$compose_filename\" . \".final\")\n \t\tor die \"Failed to open $compose_filename.final : \" . $!;\n\n-\topen(C,\"<\",$compose_filename)\n+\topen(C,\"<$compose_filename\")\n \t\tor die \"Failed to open $compose_filename : \" . $!;\n\n \twhile(<C>) {\n@@ -322,7 +321,7 @@ EOT\n }\n\n # Variables we set as part of the loop over files\n-our ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);\n+my ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);\n\n sub extract_valid_address {\n \tmy $address = shift;\n@@ -396,15 +395,15 @@ X-Mailer: git-send-email $gitversion\n \t}\n\n \tif ($smtp_server =~ m#^/#) {\n-\t\tmy $pid = open my $sm, '|-';\n+\t\tmy $pid = open SM, '|-';\n \t\tdefined $pid or die $!;\n \t\tif (!$pid) {\n \t\t\texec($smtp_server,'-i',\n \t\t\t     map { extract_valid_address($_) }\n \t\t\t     @recipients) or die $!;\n \t\t}\n-\t\tprint $sm \"$header\\n$message\";\n-\t\tclose $sm or die $?;\n+\t\tprint SM \"$header\\n$message\";\n+\t\tclose SM or die $?;\n \t} else {\n \t\trequire Net::SMTP;\n \t\t$smtp ||= Net::SMTP->new( $smtp_server );\n@@ -440,7 +439,7 @@ make_message_id();\n $subject = $initial_subject;\n\n foreach my $t (@files) {\n-\topen(F,\"<\",$t) or die \"can't open file $t\";\n+\topen(F,\"<$t\") or die \"can't open file $t\";\n\n \tmy $author_not_sender = undef;\n \t@cc = @initial_cc;\ndiff --git a/git-shortlog.perl b/git-shortlog.perl\nindex 0b14f83..57604dd 100755\n--- a/git-shortlog.perl\n+++ b/git-shortlog.perl\n@@ -128,7 +128,7 @@ sub setup_mailmap {\n \tread_mailmap(\\*DATA, \\%mailmap);\n \tif (-f '.mailmap') {\n \t\tmy $fh = undef;\n-\t\topen $fh, '<', '.mailmap';\n+\t\topen $fh, '<.mailmap';\n \t\tread_mailmap($fh, \\%mailmap);\n \t\tclose $fh;\n \t}\n--\n1.4.1\n\n\nFrom b94dcac94f70cc677d4d26aaab47a3e9eecccba2 Mon Sep 17 00:00:00 2001\nFrom: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\nDate: Sun, 30 Jul 2006 23:13:14 +0100\nSubject: [PATCH 10/10] Fix perl scripts to work with version 5.005_03.\n\nIn order to make git work on an ancient Linux (Mandrake 7.0) we\nneed to make the perl scripts work with verion 5.005_03.\n\nThe changes include:\n\n  - comment out the \"use warnings\" pragma\n  - open has only two arguments; eg. `open FH, \"<$file\"` rather\n    than `open FH, '<', $file`\n  - replace \"our\" with \"my\" in the declaration of global (package)\n    variables.\n  - replace the use of some indirect file-handles with regular\n    file-handles.\n\nNote that only those perl scripts which are exercised by the test\nsuite or that I have called directly have been modified.\n\nSigned-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n Documentation/build-docdep.perl |    2 +-\n git-annotate.perl               |   25 ++++++++++++-------------\n git-clone.sh                    |    6 +++---\n git-mv.perl                     |    4 ++--\n git-send-email.perl             |   27 +++++++++++++--------------\n git-shortlog.perl               |    2 +-\n 6 files changed, 32 insertions(+), 34 deletions(-)\n\ndiff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl\nindex 489389c..cd40f56 100755\n--- a/Documentation/build-docdep.perl\n+++ b/Documentation/build-docdep.perl\n@@ -4,7 +4,7 @@ my %include = ();\n my %included = ();\n \n for my $text (<*.txt>) {\n-    open I, '<', $text || die \"cannot read: $text\";\n+    open I, \"<$text\" || die \"cannot read: $text\";\n     while (<I>) {\n \tif (/^include::/) {\n \t    chomp;\ndiff --git a/git-annotate.perl b/git-annotate.perl\nindex a6a7a48..629f480 100755\n--- a/git-annotate.perl\n+++ b/git-annotate.perl\n@@ -6,7 +6,7 @@ #\n # This file is licensed under the GPL v2, or a later version\n # at the discretion of Linus Torvalds.\n \n-use warnings;\n+#use warnings;\n use strict;\n use Getopt::Long;\n use POSIX qw(strftime gmtime);\n@@ -29,7 +29,7 @@ sub usage() {\n \texit(1);\n }\n \n-our ($help, $longrev, $rename, $rawtime, $starting_rev, $rev_file) = (0, 0, 1);\n+my ($help, $longrev, $rename, $rawtime, $starting_rev, $rev_file) = (0, 0, 1);\n \n my $rc = GetOptions(\t\"long|l\" => \\$longrev,\n \t\t\t\"time|t\" => \\$rawtime,\n@@ -52,12 +52,12 @@ my @stack = (\n \t},\n );\n \n-our @filelines = ();\n+my @filelines = ();\n \n if (defined $starting_rev) {\n \t@filelines = git_cat_file($starting_rev, $filename);\n } else {\n-\topen(F,\"<\",$filename)\n+\topen(F,\"<$filename\")\n \t\tor die \"Failed to open filename: $!\";\n \n \twhile(<F>) {\n@@ -68,9 +68,9 @@ if (defined $starting_rev) {\n \n }\n \n-our %revs;\n-our @revqueue;\n-our $head;\n+my %revs;\n+my @revqueue;\n+my $head;\n \n my $revsprocessed = 0;\n while (my $bound = pop @stack) {\n@@ -436,14 +436,13 @@ sub format_date {\n # Copied from git-send-email.perl - We need a Git.pm module..\n sub gitvar {\n     my ($var) = @_;\n-    my $fh;\n-    my $pid = open($fh, '-|');\n+    my $pid = open(FH, '-|');\n     die \"$!\" unless defined $pid;\n     if (!$pid) {\n \texec('git-var', $var) or die \"$!\";\n     }\n-    my ($val) = <$fh>;\n-    close $fh or die \"$!\";\n+    my ($val) = <FH>;\n+    close FH or die \"$!\";\n     chomp($val);\n     return $val;\n }\n@@ -471,7 +470,7 @@ sub open_pipe_activestate {\n sub open_pipe_normal {\n \tmy (@execlist) = @_;\n \n-\tmy $pid = open my $kid, \"-|\";\n+\tmy $pid = open KID, \"-|\";\n \tdefined $pid or die \"Cannot fork: $!\";\n \n \tunless ($pid) {\n@@ -479,7 +478,7 @@ sub open_pipe_normal {\n \t\tdie \"Cannot exec @execlist: $!\";\n \t}\n \n-\treturn $kid;\n+\treturn *KID;\n }\n \n package Git::ActiveStatePipe;\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 47bd8e7..430c892 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -71,17 +71,17 @@ sub store {\n \tmy ($sha1, $name, $top) = @_;\n \t$name = \"$git_dir/refs/$top/$name\";\n \tmkpath(dirname($name));\n-\topen O, \">\", \"$name\";\n+\topen O, \">$name\";\n \tprint O \"$sha1\\n\";\n \tclose O;\n }\n \n-open FH, \"<\", \"$git_dir/CLONE_HEAD\";\n+open FH, \"<$git_dir/CLONE_HEAD\";\n while (<FH>) {\n \tmy ($sha1, $name) = /^([0-9a-f]{40})\\s(.*)$/;\n \tnext if ($name =~ /\\^\\173/);\n \tif ($name eq \"HEAD\") {\n-\t\topen O, \">\", \"$git_dir/REMOTE_HEAD\";\n+\t\topen O, \">$git_dir/REMOTE_HEAD\";\n \t\tprint O \"$sha1\\n\";\n \t\tclose O;\n \t\tnext;\ndiff --git a/git-mv.perl b/git-mv.perl\nindex 75aa8fe..7aceeb8 100755\n--- a/git-mv.perl\n+++ b/git-mv.perl\n@@ -7,7 +7,7 @@ # This file is licensed under the GPL v2\n # at the discretion of Linus Torvalds.\n \n \n-use warnings;\n+#use warnings;\n use strict;\n use Getopt::Std;\n \n@@ -19,7 +19,7 @@ EOT\n \texit(1);\n }\n \n-our ($opt_n, $opt_f, $opt_h, $opt_k, $opt_v);\n+my ($opt_n, $opt_f, $opt_h, $opt_k, $opt_v);\n getopts(\"hnfkv\") || usage;\n usage() if $opt_h;\n @ARGV >= 1 or usage;\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex c5d9e73..e670f28 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -17,7 +17,7 @@ #    and second line is the subject of t\n #\n \n use strict;\n-use warnings;\n+#use warnings;\n use Term::ReadLine;\n use Getopt::Long;\n use Data::Dumper;\n@@ -83,14 +83,13 @@ # Now, let's fill any that aren't set in\n \n sub gitvar {\n     my ($var) = @_;\n-    my $fh;\n-    my $pid = open($fh, '-|');\n+    my $pid = open(FH, '-|');\n     die \"$!\" unless defined $pid;\n     if (!$pid) {\n \texec('git-var', $var) or die \"$!\";\n     }\n-    my ($val) = <$fh>;\n-    close $fh or die \"$!\";\n+    my ($val) = <FH>;\n+    close FH or die \"$!\";\n     chomp($val);\n     return $val;\n }\n@@ -134,7 +133,7 @@ my %parse_alias = (\n \n if (@alias_files && defined $parse_alias{$aliasfiletype}) {\n \tforeach my $file (@alias_files) {\n-\t\topen my $fh, '<', $file or die \"opening $file: $!\\n\";\n+\t\topen my $fh, \"<$file\" or die \"opening $file: $!\\n\";\n \t\t$parse_alias{$aliasfiletype}->($fh);\n \t\tclose $fh;\n \t}\n@@ -209,7 +208,7 @@ if (!$smtp_server) {\n if ($compose) {\n \t# Note that this does not need to be secure, but we will make a small\n \t# effort to have it be unique\n-\topen(C,\">\",$compose_filename)\n+\topen(C,\">$compose_filename\")\n \t\tor die \"Failed to open for writing $compose_filename: $!\";\n \tprint C \"From $from # This line is ignored.\\n\";\n \tprintf C \"Subject: %s\\n\\n\", $initial_subject;\n@@ -226,10 +225,10 @@ EOT\n \t$editor = 'vi' unless defined $editor;\n \tsystem($editor, $compose_filename);\n \n-\topen(C2,\">\",$compose_filename . \".final\")\n+\topen(C2,\">$compose_filename\" . \".final\")\n \t\tor die \"Failed to open $compose_filename.final : \" . $!;\n \n-\topen(C,\"<\",$compose_filename)\n+\topen(C,\"<$compose_filename\")\n \t\tor die \"Failed to open $compose_filename : \" . $!;\n \n \twhile(<C>) {\n@@ -322,7 +321,7 @@ EOT\n }\n \n # Variables we set as part of the loop over files\n-our ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);\n+my ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);\n \n sub extract_valid_address {\n \tmy $address = shift;\n@@ -396,15 +395,15 @@ X-Mailer: git-send-email $gitversion\n \t}\n \n \tif ($smtp_server =~ m#^/#) {\n-\t\tmy $pid = open my $sm, '|-';\n+\t\tmy $pid = open SM, '|-';\n \t\tdefined $pid or die $!;\n \t\tif (!$pid) {\n \t\t\texec($smtp_server,'-i',\n \t\t\t     map { extract_valid_address($_) }\n \t\t\t     @recipients) or die $!;\n \t\t}\n-\t\tprint $sm \"$header\\n$message\";\n-\t\tclose $sm or die $?;\n+\t\tprint SM \"$header\\n$message\";\n+\t\tclose SM or die $?;\n \t} else {\n \t\trequire Net::SMTP;\n \t\t$smtp ||= Net::SMTP->new( $smtp_server );\n@@ -440,7 +439,7 @@ make_message_id();\n $subject = $initial_subject;\n \n foreach my $t (@files) {\n-\topen(F,\"<\",$t) or die \"can't open file $t\";\n+\topen(F,\"<$t\") or die \"can't open file $t\";\n \n \tmy $author_not_sender = undef;\n \t@cc = @initial_cc;\ndiff --git a/git-shortlog.perl b/git-shortlog.perl\nindex 0b14f83..57604dd 100755\n--- a/git-shortlog.perl\n+++ b/git-shortlog.perl\n@@ -128,7 +128,7 @@ sub setup_mailmap {\n \tread_mailmap(\\*DATA, \\%mailmap);\n \tif (-f '.mailmap') {\n \t\tmy $fh = undef;\n-\t\topen $fh, '<', '.mailmap';\n+\t\topen $fh, '<.mailmap';\n \t\tread_mailmap($fh, \\%mailmap);\n \t\tclose $fh;\n \t}\n-- \n1.4.1\n\n"}]}