git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Thomas Rast" <trast@student.ethz.ch>,
	"Ryan Anderson" <rda@google.com>,
	"Jay Soffian" <jaysoffian@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 03/16] send-email: use lexical filehandles during sending
Date: Thu, 30 Sep 2010 13:42:56 +0000	[thread overview]
Message-ID: <1285854189-10240-4-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1285854189-10240-1-git-send-email-avarab@gmail.com>

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 634835c..488d894 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1144,7 +1144,7 @@ $subject = $initial_subject;
 $message_num = 0;
 
 foreach my $t (@files) {
-	open(F,"<",$t) or die "can't open file $t";
+	open my $fh, "<", $t or die "can't open file $t";
 
 	my $author = undef;
 	my $author_encoding;
@@ -1157,7 +1157,7 @@ foreach my $t (@files) {
 	$message = "";
 	$message_num++;
 	# First unfold multiline header fields
-	while(<F>) {
+	while(<$fh>) {
 		last if /^\s*$/;
 		if (/^\s+\S/ and @header) {
 			chomp($header[$#header]);
@@ -1233,7 +1233,7 @@ foreach my $t (@files) {
 		}
 	}
 	# Now parse the message body
-	while(<F>) {
+	while(<$fh>) {
 		$message .=  $_;
 		if (/^(Signed-off-by|Cc): (.*)$/i) {
 			chomp;
@@ -1250,12 +1250,12 @@ foreach my $t (@files) {
 				$c, $_) unless $quiet;
 		}
 	}
-	close F;
+	close $fh;
 
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd \Q$t\E |")
+		open my $fh, "$cc_cmd \Q$t\E |"
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
-		while(<F>) {
+		while(<$fh>) {
 			my $c = $_;
 			$c =~ s/^\s*//g;
 			$c =~ s/\n$//g;
@@ -1264,7 +1264,7 @@ foreach my $t (@files) {
 			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
 				$c, $cc_cmd) unless $quiet;
 		}
-		close F
+		close $fh
 			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
 	}
 
-- 
1.7.3.159.g610493

  parent reply	other threads:[~2010-09-30 13:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 13:42 [PATCH 00/16] git-send-email cleanups Ævar Arnfjörð Bjarmason
2010-09-30 13:42 ` [PATCH 01/16] send-email: use lexical filehandle for opendir Ævar Arnfjörð Bjarmason
2010-09-30 13:42 ` [PATCH 02/16] send-email: use lexical filehandles for $compose Ævar Arnfjörð Bjarmason
2010-09-30 13:42 ` Ævar Arnfjörð Bjarmason [this message]
2010-09-30 13:42 ` [PATCH 04/16] send-email: get_patch_subject doesn't need a prototype Ævar Arnfjörð Bjarmason
2010-09-30 13:42 ` [PATCH 05/16] send-email: file_declares_8bit_cte " Ævar Arnfjörð Bjarmason
2010-09-30 13:42 ` [PATCH 06/16] send-email: unique_email_list " Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 07/16] send-email: cleanup_compose_files " Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 08/16] send-email: use \E***\Q instead of \*\*\* Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 09/16] send-email: sanitize_address use $foo, not "$foo" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 10/16] send-email: sanitize_address use qq["foo"], not "\"foo\"" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 11/16] send-email: use (?:) instead of () if no match variables are needed Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 12/16] send-email: is_rfc2047_quoted use qr// regexes Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o Ævar Arnfjörð Bjarmason
2010-09-30 16:19   ` Jeff King
2010-09-30 16:33     ` Ævar Arnfjörð Bjarmason
2010-10-01  5:40       ` Jeff King
2010-09-30 17:25     ` Junio C Hamano
2010-09-30 18:56       ` Ævar Arnfjörð Bjarmason
2010-09-30 19:03   ` [PATCH v2 13/16] send-email: extract_valid_address use qr// regexes Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 14/16] send-email: send_message die on $!, not $? Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 15/16] send-email: make_message_id use "require" instead of "use" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 ` [PATCH 16/16] send-email: use Perl idioms in while loop Ævar Arnfjörð Bjarmason
2010-09-30 14:30 ` [PATCH 00/16] git-send-email cleanups Brian Gernhardt
2010-09-30 14:52   ` Jeff King
2010-09-30 15:15     ` Brian Gernhardt
2010-09-30 15:11   ` Ævar Arnfjörð Bjarmason
2010-09-30 14:30 ` Jay Soffian
2010-09-30 16:21 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285854189-10240-4-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    --cc=rda@google.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).