if ($self->{OUT}) {
open(OUT, ">", $self->{OUT}) or $self->error("$self->{OUT} : $!");
} else {
- open(OUT, ">&", \*STDOUT) or $self->error("STDOUT : $!");
+ *OUT = ($::dispatcher->get_standard_filehandles)[1];
$self->header;
}
$self->error("$self->{IN} : " . $template->get_error());
}
- close OUT;
+ close OUT if $self->{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;