Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6ff1674f

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID 6ff1674fc7d8e48723efa5a8152ac468c5d4ea58
  • Vorgänger e8f9198a
  • Nachfolger 197cc0d8

3-arg open: Mode für zu öffnende Pipes separat sichern

Druckvorlagen mit temporären Zwischenergebnissen werden erst mit mode ">" in
eine Temp-Datei geschrieben, und dann über die ursprüngliche Pipe ausgegeben.

Der Mode für die Datei muss dabei separat gehandhabt werden.

Unterschiede anzeigen:

SL/Form.pm
1237 1237
  $main::lxdebug->enter_sub();
1238 1238

  
1239 1239
  my ($self, $myconfig) = @_;
1240
  my $out;
1240
  my ($out, $out_mode);
1241 1241

  
1242 1242
  local (*IN, *OUT);
1243 1243

  
......
1319 1319

  
1320 1320
  if ($template->uses_temp_file() || $self->{media} eq 'email') {
1321 1321
    $out = $self->{OUT};
1322
    $out_mode = $self->{OUT_MODE} || '>';
1322 1323
    $self->{OUT} = "$self->{tmpfile}";
1324
    $self->{OUT_MODE} = '>';
1323 1325
  }
1324 1326

  
1325 1327
  my $result;
1326 1328

  
1327 1329
  if ($self->{OUT}) {
1328
    open(OUT, ">", $self->{OUT}) or $self->error("$self->{OUT} : $!");
1330
    open(OUT, $self->{OUT_MODE}, $self->{OUT}) or $self->error("error on opening $self->{OUT} with mode $self->{OUT_MODE} : $!");
1329 1331
  } else {
1330 1332
    *OUT = ($::dispatcher->get_standard_filehandles)[1];
1331 1333
    $self->header;
......
1398 1400

  
1399 1401
    } else {
1400 1402

  
1401
      $self->{OUT} = $out;
1403
      $self->{OUT}      = $out;
1404
      $self->{OUT_MODE} = $out_mode;
1402 1405

  
1403 1406
      my $numbytes = (-s $self->{tmpfile});
1404 1407
      open(IN, "<", $self->{tmpfile})
......
1412 1415
      #print(STDERR "OUT $self->{OUT}\n");
1413 1416
      for my $i (1 .. $self->{copies}) {
1414 1417
        if ($self->{OUT}) {
1415
          open OUT, '>', $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
1418
          open OUT, $self->{OUT_MODE}, $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
1416 1419
          print OUT $_ while <IN>;
1417 1420
          close OUT;
1418 1421
          seek IN, 0, 0;
bin/mozilla/io.pl
1481 1481

  
1482 1482
  if ($form->{media} eq 'printer') {
1483 1483
    #$form->{OUT} = "| $form->{printer_command} &>/dev/null";
1484
    $form->{OUT} = "| $form->{printer_command} ";
1484
    $form->{OUT}      = $form->{printer_command};
1485
    $form->{OUT_MODE} = '|-';
1485 1486
    $form->{printed} .= " $form->{formname}";
1486
    $form->{printed} =~ s/^ //;
1487
    $form->{printed}  =~ s/^ //;
1487 1488
  }
1488 1489
  my $printed = $form->{printed};
1489 1490

  
......
1510 1511
    }
1511 1512

  
1512 1513
    $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
1513
    $form->{OUT} = ">" . $::lx_office_conf{paths}->{spool} . "/$filename";
1514
    $form->{OUT} = $::lx_office_conf{paths}->{spool} . "/$filename";
1515
    $form->{OUT_MODE} = '>';
1514 1516

  
1515 1517
    # add type
1516 1518
    $form->{queued} .= " $form->{formname} $filename";

Auch abrufbar als: Unified diff