Revision 7274f9c8
Von Sven Schöling vor etwa 13 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1315 | 1315 |
|
1316 | 1316 |
if ($template->uses_temp_file() || $self->{media} eq 'email') { |
1317 | 1317 |
$out = $self->{OUT}; |
1318 |
$self->{OUT} = ">$self->{tmpfile}";
|
|
1318 |
$self->{OUT} = "$self->{tmpfile}"; |
|
1319 | 1319 |
} |
1320 | 1320 |
|
1321 | 1321 |
my $result; |
1322 | 1322 |
|
1323 | 1323 |
if ($self->{OUT}) { |
1324 |
open OUT, "$self->{OUT}" or $self->error("$self->{OUT} : $!"); |
|
1325 |
$result = $template->parse(*OUT); |
|
1326 |
close OUT; |
|
1327 |
|
|
1324 |
open(OUT, ">", $self->{OUT}) or $self->error("$self->{OUT} : $!"); |
|
1328 | 1325 |
} else { |
1326 |
open(OUT, ">&", \*STDOUT) or $self->error("STDOUT : $!"); |
|
1329 | 1327 |
$self->header; |
1330 |
$result = $template->parse(*STDOUT); |
|
1331 | 1328 |
} |
1332 | 1329 |
|
1333 |
if (!$result) {
|
|
1330 |
if (!$template->parse(*OUT)) {
|
|
1334 | 1331 |
$self->cleanup(); |
1335 | 1332 |
$self->error("$self->{IN} : " . $template->get_error()); |
1336 | 1333 |
} |
1337 | 1334 |
|
1335 |
close OUT; |
|
1336 |
|
|
1338 | 1337 |
if ($self->{media} eq 'file') { |
1339 | 1338 |
copy(join('/', $self->{cwd}, $userspath, $self->{tmpfile}), $out =~ m|^/| ? $out : join('/', $self->{cwd}, $out)) if $template->uses_temp_file; |
1340 | 1339 |
$self->cleanup; |
... | ... | |
1368 | 1367 |
$myconfig->{signature} =~ s/\n/<br>\n/g; |
1369 | 1368 |
$mail->{message} .= "<br>\n-- <br>\n$myconfig->{signature}\n<br>"; |
1370 | 1369 |
|
1371 |
open(IN, $self->{tmpfile}) |
|
1370 |
open(IN, "<", $self->{tmpfile})
|
|
1372 | 1371 |
or $self->error($self->cleanup . "$self->{tmpfile} : $!"); |
1373 | 1372 |
while (<IN>) { |
1374 | 1373 |
$mail->{message} .= $_; |
... | ... | |
1398 | 1397 |
$self->{OUT} = $out; |
1399 | 1398 |
|
1400 | 1399 |
my $numbytes = (-s $self->{tmpfile}); |
1401 |
open(IN, $self->{tmpfile}) |
|
1400 |
open(IN, "<", $self->{tmpfile})
|
|
1402 | 1401 |
or $self->error($self->cleanup . "$self->{tmpfile} : $!"); |
1403 | 1402 |
binmode IN; |
1404 | 1403 |
|
... | ... | |
1409 | 1408 |
#print(STDERR "OUT $self->{OUT}\n"); |
1410 | 1409 |
for my $i (1 .. $self->{copies}) { |
1411 | 1410 |
if ($self->{OUT}) { |
1412 |
open OUT, $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!"); |
|
1411 |
open OUT, '>', $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
|
|
1413 | 1412 |
print OUT while <IN>; |
1414 |
close OUT; |
|
1415 | 1413 |
seek IN, 0, 0; |
1416 | 1414 |
|
1417 | 1415 |
} else { |
... | ... | |
1426 | 1424 |
|
1427 | 1425 |
|; |
1428 | 1426 |
|
1429 |
$::locale->with_raw_io(\*STDOUT, sub { print while <IN> }); |
|
1427 |
open(OUT, ">&", \*STDOUT) or $self->error($self->cleanup . "$!: STDOUT"); |
|
1428 |
$::locale->with_raw_io(*OUT, sub { print while <IN> }); |
|
1430 | 1429 |
} |
1430 |
close OUT; |
|
1431 | 1431 |
} |
1432 | 1432 |
|
1433 | 1433 |
close(IN); |
Auch abrufbar als: Unified diff
Alle 2-arg open in 3-arg open verwandelt.