From fe0f944f3bbe4adac815808654b16837a05905fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 30 Sep 2010 13:42:55 +0000 Subject: send-email: use lexical filehandles for $compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ævar Arnfjörð Bjarmason Reviewed-by: Jeff King > Signed-off-by: Junio C Hamano --- git-send-email.perl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'git-send-email.perl') diff --git a/git-send-email.perl b/git-send-email.perl index 2f18d83074..634835c837 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -567,7 +567,7 @@ if ($compose) { $compose_filename = ($repo ? tempfile(".gitsendemail.msg.XXXXXX", DIR => $repo->repo_path()) : tempfile(".gitsendemail.msg.XXXXXX", DIR => "."))[1]; - open(C,">",$compose_filename) + open my $c, ">", $compose_filename or die "Failed to open for writing $compose_filename: $!"; @@ -575,7 +575,7 @@ if ($compose) { my $tpl_subject = $initial_subject || ''; my $tpl_reply_to = $initial_reply_to || ''; - print C <",$compose_filename . ".final") + open my $c2, ">", $compose_filename . ".final" or die "Failed to open $compose_filename.final : " . $!; - open(C,"<",$compose_filename) + open $c, "<", $compose_filename or die "Failed to open $compose_filename : " . $!; my $need_8bit_cte = file_has_nonascii($compose_filename); my $in_body = 0; my $summary_empty = 1; - while() { + while(<$c>) { next if m/^GIT:/; if ($in_body) { $summary_empty = 0 unless (/^\n$/); } elsif (/^\n$/) { $in_body = 1; if ($need_8bit_cte) { - print C2 "MIME-Version: 1.0\n", + print $c2 "MIME-Version: 1.0\n", "Content-Type: text/plain; ", "charset=UTF-8\n", "Content-Transfer-Encoding: 8bit\n"; @@ -639,10 +639,10 @@ EOT print "To/Cc/Bcc fields are not interpreted yet, they have been ignored\n"; next; } - print C2 $_; + print $c2 $_; } - close(C); - close(C2); + close $c; + close $c2; if ($summary_empty) { print "Summary email is empty, skipping it\n"; -- cgit v1.2.3