Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7274f9c8

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

  • ID 7274f9c8e8c61b00ff7a4e2bad6accec85015a73
  • Vorgänger 48554177
  • Nachfolger f45b296f

Alle 2-arg open in 3-arg open verwandelt.

Unterschiede anzeigen:

SL/AM.pm
1009 1009

  
1010 1010
  my $error = "";
1011 1011

  
1012
  if (open(TEMPLATE, ">$filename")) {
1012
  if (open(TEMPLATE, ">", $filename)) {
1013 1013
    $content = Encode::encode('utf-8-strict', $content) if $::locale->is_utf8;
1014 1014
    $content =~ s/\r\n/\n/g;
1015 1015
    print(TEMPLATE $content);
SL/DATEV.pm
868 868
    $kne_file->add_block($mandantenendsumme);
869 869
    $kne_file->flush();
870 870

  
871
    open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
871
    open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
872 872
    print(ED $kne_file->get_data());
873 873
    close(ED);
874 874

  
......
880 880
  my $ev_header = &make_ev_header($form, $fileno);
881 881
  my $ev_filename = $export_path . $evfile;
882 882
  push(@filenames, $evfile);
883
  open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
883
  open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
884 884
  print(EV $ev_header);
885 885

  
886 886
  foreach my $file (@ed_versionset) {
......
922 922
  $filename++;
923 923
  my $ed_filename = $export_path . $filename;
924 924
  push(@filenames, $filename);
925
  open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
925
  open(ED, ">", $ed_filename) or die "can't open outputfile: $!\n";
926 926
  my $header = &make_kne_data_header($myconfig, $form, "");
927 927
  $remaining_bytes -= length($header);
928 928

  
......
994 994
  my $ev_header = &make_ev_header($form, $fileno);
995 995
  my $ev_filename = $export_path . $evfile;
996 996
  push(@filenames, $evfile);
997
  open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
997
  open(EV, ">", $ev_filename) or die "can't open outputfile: EV01\n";
998 998
  print(EV $ev_header);
999 999

  
1000 1000
  foreach my $file (@ed_versionset) {
SL/DN.pm
794 794

  
795 795
  my $filename          = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf";
796 796
  my $spool             = $::lx_office_conf{paths}->{spool};
797
  $form->{OUT}          = ">${spool}/$filename";
797
  $form->{OUT}          = "${spool}/$filename";
798 798
  $form->{keep_tmpfile} = 1;
799 799

  
800 800
  delete $form->{tmpfile};
......
888 888
  my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf";
889 889

  
890 890
  my $spool             = $::lx_office_conf{paths}->{spool};
891
  $form->{OUT}          = ">$spool/$filename";
891
  $form->{OUT}          = "$spool/$filename";
892 892
  $form->{keep_tmpfile} = 1;
893 893
  delete $form->{tmpfile};
894 894

  
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);
SL/LXDebug.pm
262 262
  chomp($message);
263 263

  
264 264
  if ((FILE_TARGET == $self->{"target"})
265
      && open(FILE, ">>" . $self->{"file"})) {
265
      && open(FILE, ">>", $self->{"file"})) {
266 266
    print(FILE "${date}${message}\n");
267 267
    close(FILE);
268 268

  
SL/Template/OpenDocument.pm
389 389

  
390 390
  local *OUT;
391 391
  my $dfname = $self->{"userspath"} . "/xvfb_display";
392
  if (!open(OUT, ">$dfname")) {
392
  if (!open(OUT, ">", $dfname)) {
393 393
    $self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started ($dfname: $!)";
394 394
    unlink($xauthority);
395 395
    kill($pid);
SL/User.pm
150 150
      }
151 151

  
152 152
      # update the tables
153
      if (!open(FH, ">" . $::lx_office_conf{paths}->{userspath} . "/nologin")) {
153
      if (!open(FH, ">", $::lx_office_conf{paths}->{userspath} . "/nologin")) {
154 154
        $form->show_generic_error($main::locale->text('A temporary file could not be created. ' .
155 155
                                                      'Please verify that the directory "#1" is writeable by the webserver.',
156 156
                                                      $::lx_office_conf{paths}->{userspath}),
bin/mozilla/admin.pl
549 549
      closedir TEMPLATEDIR;
550 550

  
551 551
      foreach my $file (@templates) {
552
        open(TEMP, $::lx_office_conf{paths}->{templates} . "/$file")
552
        open(TEMP, "<", $::lx_office_conf{paths}->{templates} . "/$file")
553 553
          or $form->error($::lx_office_conf{paths}->{templates} . "/$file : $ERRNO");
554 554

  
555 555
        $file =~ s/\Q$form->{mastertemplates}\E-//;
556
        open(NEW, ">$form->{templates}/$file")
556
        open(NEW, ">", "$form->{templates}/$file")
557 557
          or $form->error("$form->{templates}/$file : $ERRNO");
558 558

  
559 559
        while (my $line = <TEMP>) {
......
1137 1137
  my $form   = $main::form;
1138 1138
  my $locale = $main::locale;
1139 1139

  
1140
  open(FH, ">" . _nologin_file_name())
1140
  open(FH, ">", _nologin_file_name())
1141 1141
    or $form->error($locale->text('Cannot create Lock!'));
1142 1142
  close(FH);
1143 1143

  
t/Support/Systemexec.pm
3 3
package Support::Systemexec;
4 4
require Exporter;
5 5
@ISA = qw(Exporter);
6
@EXPORT = qw(system exec);
6
@EXPORT = qw(system exec open);
7 7
@EXPORT_OK = qw();
8 8
sub system($$@) {
9 9
  1;
......
11 11
sub exec($$@) {
12 12
  1;
13 13
}
14
sub open(*$$@) {
15
  1;
16
}
14 17
1;

Auch abrufbar als: Unified diff