my $error = "";
- if (open(TEMPLATE, ">$filename")) {
+ if (open(TEMPLATE, ">", $filename)) {
$content = Encode::encode('utf-8-strict', $content) if $::locale->is_utf8;
$content =~ s/\r\n/\n/g;
print(TEMPLATE $content);
$kne_file->add_block($mandantenendsumme);
$kne_file->flush();
- open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
+ open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
print(ED $kne_file->get_data());
close(ED);
my $ev_header = &make_ev_header($form, $fileno);
my $ev_filename = $export_path . $evfile;
push(@filenames, $evfile);
- open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
+ open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
print(EV $ev_header);
foreach my $file (@ed_versionset) {
$filename++;
my $ed_filename = $export_path . $filename;
push(@filenames, $filename);
- open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
+ open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
my $header = &make_kne_data_header($myconfig, $form, "");
$remaining_bytes -= length($header);
my $ev_header = &make_ev_header($form, $fileno);
my $ev_filename = $export_path . $evfile;
push(@filenames, $evfile);
- open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
+ open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
print(EV $ev_header);
foreach my $file (@ed_versionset) {
my $filename = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf";
my $spool = $::lx_office_conf{paths}->{spool};
- $form->{OUT} = ">${spool}/$filename";
+ $form->{OUT} = "${spool}/$filename";
$form->{keep_tmpfile} = 1;
delete $form->{tmpfile};
my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf";
my $spool = $::lx_office_conf{paths}->{spool};
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = "$spool/$filename";
$form->{keep_tmpfile} = 1;
delete $form->{tmpfile};
if ($template->uses_temp_file() || $self->{media} eq 'email') {
$out = $self->{OUT};
- $self->{OUT} = ">$self->{tmpfile}";
+ $self->{OUT} = "$self->{tmpfile}";
}
my $result;
if ($self->{OUT}) {
- open OUT, "$self->{OUT}" or $self->error("$self->{OUT} : $!");
- $result = $template->parse(*OUT);
- close OUT;
-
+ open(OUT, ">", $self->{OUT}) or $self->error("$self->{OUT} : $!");
} else {
+ open(OUT, ">&", \*STDOUT) or $self->error("STDOUT : $!");
$self->header;
- $result = $template->parse(*STDOUT);
}
- if (!$result) {
+ if (!$template->parse(*OUT)) {
$self->cleanup();
$self->error("$self->{IN} : " . $template->get_error());
}
+ close OUT;
+
if ($self->{media} eq 'file') {
copy(join('/', $self->{cwd}, $userspath, $self->{tmpfile}), $out =~ m|^/| ? $out : join('/', $self->{cwd}, $out)) if $template->uses_temp_file;
$self->cleanup;
$myconfig->{signature} =~ s/\n/<br>\n/g;
$mail->{message} .= "<br>\n-- <br>\n$myconfig->{signature}\n<br>";
- open(IN, $self->{tmpfile})
+ open(IN, "<", $self->{tmpfile})
or $self->error($self->cleanup . "$self->{tmpfile} : $!");
while (<IN>) {
$mail->{message} .= $_;
$self->{OUT} = $out;
my $numbytes = (-s $self->{tmpfile});
- open(IN, $self->{tmpfile})
+ open(IN, "<", $self->{tmpfile})
or $self->error($self->cleanup . "$self->{tmpfile} : $!");
binmode IN;
#print(STDERR "OUT $self->{OUT}\n");
for my $i (1 .. $self->{copies}) {
if ($self->{OUT}) {
- open OUT, $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
+ open OUT, '>', $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
print OUT while <IN>;
- close OUT;
seek IN, 0, 0;
} else {
|;
- $::locale->with_raw_io(\*STDOUT, sub { print while <IN> });
+ open(OUT, ">&", \*STDOUT) or $self->error($self->cleanup . "$!: STDOUT");
+ $::locale->with_raw_io(*OUT, sub { print while <IN> });
}
+ close OUT;
}
close(IN);
chomp($message);
if ((FILE_TARGET == $self->{"target"})
- && open(FILE, ">>" . $self->{"file"})) {
+ && open(FILE, ">>", $self->{"file"})) {
print(FILE "${date}${message}\n");
close(FILE);
local *OUT;
my $dfname = $self->{"userspath"} . "/xvfb_display";
- if (!open(OUT, ">$dfname")) {
+ if (!open(OUT, ">", $dfname)) {
$self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started ($dfname: $!)";
unlink($xauthority);
kill($pid);
}
# update the tables
- if (!open(FH, ">" . $::lx_office_conf{paths}->{userspath} . "/nologin")) {
+ if (!open(FH, ">", $::lx_office_conf{paths}->{userspath} . "/nologin")) {
$form->show_generic_error($main::locale->text('A temporary file could not be created. ' .
'Please verify that the directory "#1" is writeable by the webserver.',
$::lx_office_conf{paths}->{userspath}),
closedir TEMPLATEDIR;
foreach my $file (@templates) {
- open(TEMP, $::lx_office_conf{paths}->{templates} . "/$file")
+ open(TEMP, "<", $::lx_office_conf{paths}->{templates} . "/$file")
or $form->error($::lx_office_conf{paths}->{templates} . "/$file : $ERRNO");
$file =~ s/\Q$form->{mastertemplates}\E-//;
- open(NEW, ">$form->{templates}/$file")
+ open(NEW, ">", "$form->{templates}/$file")
or $form->error("$form->{templates}/$file : $ERRNO");
while (my $line = <TEMP>) {
my $form = $main::form;
my $locale = $main::locale;
- open(FH, ">" . _nologin_file_name())
+ open(FH, ">", _nologin_file_name())
or $form->error($locale->text('Cannot create Lock!'));
close(FH);
package Support::Systemexec;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(system exec);
+@EXPORT = qw(system exec open);
@EXPORT_OK = qw();
sub system($$@) {
1;
sub exec($$@) {
1;
}
+sub open(*$$@) {
+ 1;
+}
1;