From 974b5d8664caba8cebfccc55b1be53a09916a200 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 11 May 2007 11:55:56 +0000 Subject: [PATCH] Filehandles lokal deklarieren. Kosmetik. In Mailer.pm open() nur mit festgelegtem Argument aufrufen. --- SL/Form.pm | 7 +++++-- SL/Mailer.pm | 17 ++++++----------- bin/mozilla/io.pl | 2 -- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index f29c67166..5a5005eff 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -731,7 +731,9 @@ sub parse_template { $main::lxdebug->enter_sub(); my ($self, $myconfig, $userspath) = @_; - my $template; + my ($template, $out); + + local (*IN, *OUT); $self->{"cwd"} = getcwd(); $self->{"tmpdir"} = $self->{cwd} . "/${userspath}"; @@ -775,6 +777,7 @@ sub parse_template { # for postscript we store a copy in a temporary file my $fileid = time; $self->{tmpfile} ||= "$userspath/${fileid}.$self->{IN}"; + if ($template->uses_temp_file() || $self->{media} eq 'email') { $out = $self->{OUT}; $self->{OUT} = ">$self->{tmpfile}"; @@ -841,7 +844,7 @@ sub parse_template { } - my $err = $mail->send($out); + my $err = $mail->send(); $self->error($self->cleanup . "$err") if ($err); } else { diff --git a/SL/Mailer.pm b/SL/Mailer.pm index aec34e67d..7b011d4b0 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -89,7 +89,9 @@ sub mime_quote_text { sub send { $main::lxdebug->enter_sub(); - my ($self, $out) = @_; + my ($self) = @_; + + local (*IN, *OUT); my $boundary = time; $boundary = "LxOffice-$self->{version}-$boundary"; @@ -99,16 +101,9 @@ sub send { $self->{charset} = Common::DEFAULT_CHARSET unless $self->{charset}; - if ($out) { - if (!open(OUT, $out)) { - $main::lxdebug->leave_sub(); - return "$out : $!"; - } - } else { - if (!open(OUT, ">-")) { - $main::lxdebug->leave_sub(); - return "STDOUT : $!"; - } + if (!open(OUT, $main::sendmail)) { + $main::lxdebug->leave_sub(); + return "$main::sendmail : $!"; } $self->{contenttype} = "text/plain" unless $self->{contenttype}; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 6975fd9c1..d150c2ca0 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1748,8 +1748,6 @@ sub print_form { $form->{subject} = qq|$form->{label} $form->{"${inv}number"}| unless $form->{subject}; - $form->{OUT} = "$sendmail"; - $form->{emailed} .= " $form->{formname}"; $form->{emailed} =~ s/^ //; } -- 2.20.1