$main::lxdebug->enter_sub();
my ($self, $myconfig) = @_;
- my $out;
+ my ($out, $out_mode);
local (*IN, *OUT);
if ($template->uses_temp_file() || $self->{media} eq 'email') {
$out = $self->{OUT};
+ $out_mode = $self->{OUT_MODE} || '>';
$self->{OUT} = "$self->{tmpfile}";
+ $self->{OUT_MODE} = '>';
}
my $result;
if ($self->{OUT}) {
- open(OUT, ">", $self->{OUT}) or $self->error("$self->{OUT} : $!");
+ open(OUT, $self->{OUT_MODE}, $self->{OUT}) or $self->error("error on opening $self->{OUT} with mode $self->{OUT_MODE} : $!");
} else {
*OUT = ($::dispatcher->get_standard_filehandles)[1];
$self->header;
} else {
- $self->{OUT} = $out;
+ $self->{OUT} = $out;
+ $self->{OUT_MODE} = $out_mode;
my $numbytes = (-s $self->{tmpfile});
open(IN, "<", $self->{tmpfile})
#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_MODE}, $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
print OUT $_ while <IN>;
close OUT;
seek IN, 0, 0;
if ($form->{media} eq 'printer') {
#$form->{OUT} = "| $form->{printer_command} &>/dev/null";
- $form->{OUT} = "| $form->{printer_command} ";
+ $form->{OUT} = $form->{printer_command};
+ $form->{OUT_MODE} = '|-';
$form->{printed} .= " $form->{formname}";
- $form->{printed} =~ s/^ //;
+ $form->{printed} =~ s/^ //;
}
my $printed = $form->{printed};
}
$filename .= ($form->{postscript}) ? '.ps' : '.pdf';
- $form->{OUT} = ">" . $::lx_office_conf{paths}->{spool} . "/$filename";
+ $form->{OUT} = $::lx_office_conf{paths}->{spool} . "/$filename";
+ $form->{OUT_MODE} = '>';
# add type
$form->{queued} .= " $form->{formname} $filename";