summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-12-05 04:53:13 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-12-05 04:53:13 +0000
commit036f60865172bc36e1468afd64d5ac775fa39529 (patch)
treeff6390d7252a3d6783bf717cf723069f09e1f9a4
parent9328565f48fb505f789c371433088a46b0e6a693 (diff)
Converting 2-arg open to 3-arg open
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@720 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/AM.pm10
-rwxr-xr-xLedgerSMB/BP.pm4
-rwxr-xr-xLedgerSMB/Form.pm24
-rwxr-xr-xLedgerSMB/Inifile.pm2
-rwxr-xr-xLedgerSMB/User.pm2
-rwxr-xr-xLedgerSMB/locales.pl10
-rwxr-xr-xbin/admin.pl10
-rwxr-xr-xbin/am.pl4
-rwxr-xr-xbin/login.pl4
-rw-r--r--dists/win32/shebang-activeperl.pl2
-rw-r--r--dists/win32/shebang-vanilla.pl2
-rwxr-xr-ximport_members.pl2
-rwxr-xr-xsetup.pl16
-rw-r--r--utils/notify_short/listener.pl2
14 files changed, 47 insertions, 47 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 15ea3e33..23f5658b 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -1278,7 +1278,7 @@ sub load_template {
my ($self, $myconfig, $form) = @_;
$self->check_template_name(\%$myconfig, \%$form);
- open(TEMPLATE, "$form->{file}") or $form->error("$form->{file} : $!");
+ open(TEMPLATE, '<', "$form->{file}") or $form->error("$form->{file} : $!");
while (<TEMPLATE>) {
$form->{body} .= $_;
@@ -1294,7 +1294,7 @@ sub save_template {
my ($self, $myconfig, $form) = @_;
$self->check_template_name(\%$myconfig, \%$form);
- open(TEMPLATE, ">$form->{file}") or $form->error("$form->{file} : $!");
+ open(TEMPLATE, '>', "$form->{file}") or $form->error("$form->{file} : $!");
# strip
$form->{body} =~ s/\r//g;
@@ -1610,9 +1610,9 @@ sub backup {
my $boundary = time;
my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
$tmpfile .= ".gz" if ${LedgerSMB::Sysconfig::gzip};
- $form->{OUT} = ">$tmpfile";
+ $form->{OUT} = "$tmpfile";
- open(OUT, "$form->{OUT}") or $form->error("$form->{OUT} : $!");
+ open(OUT, '>', "$form->{OUT}") or $form->error("$form->{OUT} : $!");
# get sequences, functions and triggers
@@ -1653,7 +1653,7 @@ sub backup {
if ($form->{media} eq 'file') {
- open(IN, "$tmpfile") or $form->error("$tmpfile : $!");
+ open(IN, '<', "$tmpfile") or $form->error("$tmpfile : $!");
open(OUT, ">-") or $form->error("STDOUT : $!");
print OUT qq|Content-Type: application/file;\n| .
diff --git a/LedgerSMB/BP.pm b/LedgerSMB/BP.pm
index d15dc018..5e43eade 100755
--- a/LedgerSMB/BP.pm
+++ b/LedgerSMB/BP.pm
@@ -342,13 +342,13 @@ sub print_spool {
foreach my $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
- open(OUT, $form->{OUT}) or $form->error("$form->{OUT} : $!");
+ open(OUT, '>', $form->{OUT}) or $form->error("$form->{OUT} : $!");
binmode(OUT);
$spoolfile = qq|$spool/$form->{"spoolfile_$i"}|;
# send file to printer
- open(IN, $spoolfile) or $form->error("$spoolfile : $!");
+ open(IN, '<', $spoolfile) or $form->error("$spoolfile : $!");
binmode(IN);
while (<IN>) {
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 618a1e3d..7409b4a8 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -84,7 +84,7 @@ sub debug {
my ($self, $file) = @_;
if ($file) {
- open(FH, "> $file") or die $!;
+ open(FH, '>', "$file") or die $!;
for (sort keys %$self) { print FH "$_ = $self->{$_}\n" }
close(FH);
} else {
@@ -577,13 +577,13 @@ sub parse_template {
if ($self->{language_code}) {
if (-f "$self->{templates}/$self->{language_code}/$self->{IN}") {
- open(IN, "$self->{templates}/$self->{language_code}/$self->{IN}") or $self->error("$self->{IN} : $!");
+ open(IN, '<', "$self->{templates}/$self->{language_code}/$self->{IN}") or $self->error("$self->{IN} : $!");
} else {
- open(IN, "$self->{templates}/$self->{IN}") or $self->error("$self->{IN} : $!");
+ open(IN, '<', "$self->{templates}/$self->{IN}") or $self->error("$self->{IN} : $!");
}
} else {
- open(IN, "$self->{templates}/$self->{IN}") or $self->error("$self->{IN} : $!");
+ open(IN, '<', "$self->{templates}/$self->{IN}") or $self->error("$self->{IN} : $!");
}
@_ = <IN>;
@@ -600,11 +600,11 @@ sub parse_template {
if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') {
my $out = $self->{OUT};
- $self->{OUT} = ">$self->{tmpfile}";
+ $self->{OUT} = "$self->{tmpfile}";
}
if ($self->{OUT}) {
- open(OUT, "$self->{OUT}") or $self->error("$self->{OUT} : $!");
+ open(OUT, '>', "$self->{OUT}") or $self->error("$self->{OUT} : $!");
} else {
open(OUT, ">-") or $self->error("STDOUT : $!");
@@ -786,7 +786,7 @@ sub parse_template {
# assume loop after 10 includes of the same file
next if ($include{$var} > 10);
- unless (open(INC, "$self->{templates}/$self->{language_code}/$var")) {
+ unless (open(INC, '<', "$self->{templates}/$self->{language_code}/$var")) {
$err = $!;
$self->cleanup;
$self->error("$self->{templates}/$self->{language_code}/$var : $err");
@@ -890,7 +890,7 @@ sub parse_template {
$myconfig->{signature} =~ s/\\n/$br\n/g;
$mail->{message} .= "$br\n-- $br\n$myconfig->{signature}\n$br" if $myconfig->{signature};
- unless (open(IN, $self->{tmpfile})) {
+ unless (open(IN, '<', $self->{tmpfile})) {
$err = $!;
$self->cleanup;
$self->error("$self->{tmpfile} : $err");
@@ -920,7 +920,7 @@ sub parse_template {
$self->{OUT} = $out;
- unless (open(IN, $self->{tmpfile})) {
+ unless (open(IN, '<', $self->{tmpfile})) {
$err = $!;
$self->cleanup;
$self->error("$self->{tmpfile} : $err");
@@ -935,7 +935,7 @@ sub parse_template {
for my $i (1 .. $self->{copies}) {
if ($self->{OUT}) {
- unless (open(OUT, $self->{OUT})) {
+ unless (open(OUT, '>', $self->{OUT})) {
$err = $!;
$self->cleanup;
$self->error("$self->{OUT} : $err");
@@ -1115,7 +1115,7 @@ sub cleanup {
my @err = ();
if (-f "$self->{errfile}") {
- open(FH, "$self->{errfile}");
+ open(FH, '<', "$self->{errfile}");
@err = <FH>;
close(FH);
}
@@ -1140,7 +1140,7 @@ sub rerun_latex {
my $a = 0;
if (-f "$self->{errfile}") {
- open(FH, "$self->{errfile}");
+ open(FH, '<', "$self->{errfile}");
$a = grep /(longtable Warning:|Warning:.*?LastPage)/, <FH>;
close(FH);
}
diff --git a/LedgerSMB/Inifile.pm b/LedgerSMB/Inifile.pm
index 9922c63c..839c19f3 100755
--- a/LedgerSMB/Inifile.pm
+++ b/LedgerSMB/Inifile.pm
@@ -57,7 +57,7 @@ sub add_file {
for (@{$self->{ORDER}}) { $menuorder{$_} = 1 }
- open FH, "$file" or Form->error("$file : $!");
+ open FH, '<', "$file" or Form->error("$file : $!");
while (<FH>) {
next if /^(#|;|\s)/;
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index 8cc551bc..6e4a872e 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -471,7 +471,7 @@ sub dbsources_unused {
$form->error(__FILE__.':'.__LINE__.": $memfile locked!") if (-f "${memfile}.LCK");
# open members file
- open(FH, "$memfile") or $form->error(__FILE__.':'.__LINE__.": $memfile : $!");
+ open(FH, '<', "$memfile") or $form->error(__FILE__.':'.__LINE__.": $memfile : $!");
while (<FH>) {
if (/^dbname=/) {
diff --git a/LedgerSMB/locales.pl b/LedgerSMB/locales.pl
index 91f61015..0bfc2503 100755
--- a/LedgerSMB/locales.pl
+++ b/LedgerSMB/locales.pl
@@ -110,7 +110,7 @@ foreach $file (@progfiles) {
}
}
- open FH, ">$file" or die "$! : $file";
+ open FH, '>', "$file" or die "$! : $file";
if ($charset) {
print FH qq|\$self{charset} = '$charset';\n\n|;
@@ -179,7 +179,7 @@ $self{subs} = {
if (!$noMissing) {
if (@missing) {
- open FH, ">$file.missing" or die "$! : missing";
+ open FH, '>', "$file.missing" or die "$! : missing";
print FH qq|# module $file
# add the missing texts and run locales.pl to rebuild
@@ -206,7 +206,7 @@ $self{subs} = {
# redo the all file
if ($buildAll) {
- open FH, ">all" or die "$! : all";
+ open FH, '>', "all" or die "$! : all";
print FH q|# These are all the texts to build the translations files.
# to build unique strings edit the module files instead
@@ -255,7 +255,7 @@ sub scanfile {
my $fh = new FileHandle;
return unless (-e $file or $file !~ /custom/);
- open $fh, "$file" or die "$! : $file";
+ open $fh, '<', "$file" or die "$! : $file";
$file =~ s/\.pl//;
$file =~ s/$bindir\///;
@@ -344,7 +344,7 @@ sub scanmenu {
my $file = shift;
my $fh = new FileHandle;
- open $fh, "$file" or die "$! : $file";
+ open $fh, '<', "$file" or die "$! : $file";
my @a = grep /^\[/, <$fh>;
close($fh);
diff --git a/bin/admin.pl b/bin/admin.pl
index 1a0a765b..0ecbe449 100755
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -589,12 +589,12 @@ sub form_header {
# access control
- open(FH, $menufile) or $form->error(__FILE__.':'.__LINE__.': '."$menufile : $!");
+ open(FH, '<', $menufile) or $form->error(__FILE__.':'.__LINE__.': '."$menufile : $!");
# scan for first menu level
@a = <FH>;
close(FH);
- if (open(FH, "custom_$menufile")) {
+ if (open(FH, '<', "custom_$menufile")) {
push @a, <FH>;
}
@@ -801,10 +801,10 @@ sub save {
foreach $file (@templates) {
- open(TEMP, "${LedgerSMB::Sysconfig::templates}/$file") or $form->error(__FILE__.':'.__LINE__.': '."$templates/$file : $!");
+ open(TEMP, '<', "${LedgerSMB::Sysconfig::templates}/$file") or $form->error(__FILE__.':'.__LINE__.': '."$templates/$file : $!");
$file =~ s/$form->{mastertemplates}-//;
- open(NEW, ">$form->{templates}/$file") or $form->error(__FILE__.':'.__LINE__.': '."$form->{templates}/$file : $!");
+ open(NEW, '>', "$form->{templates}/$file") or $form->error(__FILE__.':'.__LINE__.': '."$form->{templates}/$file : $!");
while ($line = <TEMP>) {
print NEW $line;
@@ -1297,7 +1297,7 @@ sub unlock_system {
sub lock_system {
# This needs to be done with a db tool
- #open(FH, ">${LedgerSMB::Sysconfig::userspath}/nologin") or $form->error($locale->text('Cannot create Lock!'));
+ #open(FH, '>', "${LedgerSMB::Sysconfig::userspath}/nologin") or $form->error($locale->text('Cannot create Lock!'));
#close(FH);
$form->{callback} = "$form->{script}?action=list_users&amp;path=$form->{path}";
$form->redirect($locale->text('Lockfile created!'));
diff --git a/bin/am.pl b/bin/am.pl
index 56820e39..60c53500 100755
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -1407,9 +1407,9 @@ sub save_language {
foreach $file (@templates) {
if (-f "$myconfig{templates}/$file") {
- open(TEMP, "$myconfig{templates}/$file") or $form->error("$myconfig{templates}/$file : $!");
+ open(TEMP, '<', "$myconfig{templates}/$file") or $form->error("$myconfig{templates}/$file : $!");
- open(NEW, ">$myconfig{templates}/$form->{code}/$file") or $form->error("$myconfig{templates}/$form->{code}/$file : $!");
+ open(NEW, '>', "$myconfig{templates}/$form->{code}/$file") or $form->error("$myconfig{templates}/$form->{code}/$file : $!");
while ($line = <TEMP>) {
print NEW $line;
diff --git a/bin/login.pl b/bin/login.pl
index 8fe9a7cf..bff94a10 100755
--- a/bin/login.pl
+++ b/bin/login.pl
@@ -238,7 +238,7 @@ sub login {
#this needs to be done via db
#if (! $form->{beenthere}) {
- # open(FH, "${LedgerSMB::Sysconfig::memberfile}") or $form->error(__FILE__.':'.__LINE__.": $memberfile : $!");
+ # open(FH, '<', "${LedgerSMB::Sysconfig::memberfile}") or $form->error(__FILE__.':'.__LINE__.": $memberfile : $!");
# @a = <FH>;
# close(FH);
#
@@ -282,7 +282,7 @@ sub login {
# upgrade dataset and log in again
#locking needs to be done via db function
- #open FH, ">${LedgerSMB::Sysconfig::userspath}/nologin" or $form->error($!);
+ #open FH, '>', "${LedgerSMB::Sysconfig::userspath}/nologin" or $form->error($!);
for (qw(dbname dbhost dbport dbdriver dbuser dbpasswd)) { $form->{$_} = $user->{$_} }
diff --git a/dists/win32/shebang-activeperl.pl b/dists/win32/shebang-activeperl.pl
index 6fce8c24..a0621839 100644
--- a/dists/win32/shebang-activeperl.pl
+++ b/dists/win32/shebang-activeperl.pl
@@ -7,7 +7,7 @@
closedir DIR;
foreach $file (@perlfiles) {
- open FH, "+<$file";
+ open FH, '+<', "$file";
@file = <FH>;
diff --git a/dists/win32/shebang-vanilla.pl b/dists/win32/shebang-vanilla.pl
index 73d02590..9921a723 100644
--- a/dists/win32/shebang-vanilla.pl
+++ b/dists/win32/shebang-vanilla.pl
@@ -7,7 +7,7 @@
closedir DIR;
foreach $file (@perlfiles) {
- open FH, "+<$file";
+ open FH, '+<', "$file";
@file = <FH>;
diff --git a/import_members.pl b/import_members.pl
index 1cd70d54..d9eb87ae 100755
--- a/import_members.pl
+++ b/import_members.pl
@@ -50,7 +50,7 @@ if (length($membersfile) < 2){
my @users = ();
-open(FH, "$membersfile") || die ("Couldn't open members file!");
+open(FH, '<', "$membersfile") || die ("Couldn't open members file!");
while (<FH>) {
diff --git a/setup.pl b/setup.pl
index 231df759..4b70aec0 100755
--- a/setup.pl
+++ b/setup.pl
@@ -124,7 +124,7 @@ if ($filename) {
if (-f "VERSION") {
# get installed version from VERSION file
- open(FH, "VERSION");
+ open(FH, '<', "VERSION");
@a = <FH>;
close(FH);
$version = $a[0];
@@ -429,13 +429,13 @@ sub install_smb {
&decompress;
if ($newinstall) {
- open(FH, "ledger-smb.conf.default");
+ open(FH, '<', "ledger-smb.conf.default");
@f = <FH>;
close(FH);
unless ($latex) {
grep { s/^\$latex.*/\$latex = 0;/ } @f;
}
- open(FH, ">ledger-smb.conf");
+ open(FH, '>', "ledger-smb.conf");
print FH @f;
close(FH);
@@ -450,12 +450,12 @@ sub install_smb {
$filename = "ledger-smb-httpd.conf";
# do we have write permission?
- if (!open(FH, ">>$httpddir/$filename")) {
- open(FH, ">$filename");
+ if (!open(FH, '>>', "$httpddir/$filename")) {
+ open(FH, '>', "$filename");
$norw = 1;
}
- open (HTTPD, '< sql-ledger-httpd.conf');
+ open (HTTPD, '<', 'sql-ledger-httpd.conf');
while ($line = <HTTPD>){
print FH $line;
}
@@ -506,7 +506,7 @@ Webserver directives were written to
if (!$confd) {
if (!(`grep "^# LedgerSMB" $httpd`)) {
- open(FH, ">>$httpd");
+ open(FH, '>>', "$httpd");
print FH qq|
@@ -618,7 +618,7 @@ sub decompress {
sub create_lockfile {
if (-d "$userspath") {
- open(FH, ">$userspath/nologin");
+ open(FH, '>', "$userspath/nologin");
close(FH);
}
diff --git a/utils/notify_short/listener.pl b/utils/notify_short/listener.pl
index 37f31d38..a9286795 100644
--- a/utils/notify_short/listener.pl
+++ b/utils/notify_short/listener.pl
@@ -30,7 +30,7 @@ while (1){ # loop infinitely
sleep $cycle_delay;
}
sub on_notify {
- open (MAIL, "| $sendmail");
+ open (MAIL, '|-', "$sendmail");
$sth = $dbh->prepare("
SELECT partnumber, description, onhand, rop FROM parts
WHERE onhand <= rop