summaryrefslogtreecommitdiffstats
path: root/perl-install/printer/office.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-02 23:18:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-02 23:18:47 +0000
commitad9f5530fc680a154f87283652a676a259c62935 (patch)
treed7cebc05c3c9028c402efa9627d52072d85d59de /perl-install/printer/office.pm
parent58a833eef06f5ebac63dbc025c6b0dd00753bb2d (diff)
downloaddrakx-backup-do-not-use-ad9f5530fc680a154f87283652a676a259c62935.tar
drakx-backup-do-not-use-ad9f5530fc680a154f87283652a676a259c62935.tar.gz
drakx-backup-do-not-use-ad9f5530fc680a154f87283652a676a259c62935.tar.bz2
drakx-backup-do-not-use-ad9f5530fc680a154f87283652a676a259c62935.tar.xz
drakx-backup-do-not-use-ad9f5530fc680a154f87283652a676a259c62935.zip
simplify
Diffstat (limited to 'perl-install/printer/office.pm')
-rw-r--r--perl-install/printer/office.pm31
1 files changed, 9 insertions, 22 deletions
diff --git a/perl-install/printer/office.pm b/perl-install/printer/office.pm
index 459ae4d8e..48bfe52f5 100644
--- a/perl-install/printer/office.pm
+++ b/perl-install/printer/office.pm
@@ -45,7 +45,7 @@ sub configureoffice {
$configfilename =~ m!$suites{$suite}{file_name}!;
my $configprefix = $1;
# Load Star Office printer config file
- my $configfilecontent = readsofficeconfigfile($configfilename);
+ my $configfilecontent = cat_("$::prefix$configfilename");
# Update remote CUPS queues
if (0 && $printer->{SPOOLER} eq "cups" &&
(-x "$::prefix/usr/bin/curl" || -x "$::prefix/usr/bin/wget")) {
@@ -100,7 +100,7 @@ sub configureoffice {
$configfilecontent = removeentry(@parameters, $configfilecontent);
$configfilecontent = addentry($parameters[0], $parameters[1] . $suites{$suite}{perl} . $spoolers{$printer->{SPOOLER}{print_command}}, $configfilecontent);
# Write back Star Office configuration file
- return writesofficeconfigfile($configfilename, $configfilecontent);
+ return eval { output("$::prefix$configfilename", $configfilecontent) };
}
sub add_cups_remote_to_office {
@@ -111,7 +111,7 @@ sub add_cups_remote_to_office {
$configfilename =~ m!$suites{$suite}{file_name}!;
my $configprefix = $1;
# Load Star Office printer config file
- my $configfilecontent = readsofficeconfigfile($configfilename);
+ my $configfilecontent = cat_("$::prefix$configfilename");
# Update remote CUPS queues
if ($printer->{SPOOLER} eq "cups" &&
(-x "$::prefix/usr/bin/curl" || -x "$::prefix/usr/bin/wget")) {
@@ -149,7 +149,7 @@ sub add_cups_remote_to_office {
}
}
# Write back Star Office configuration file
- return writesofficeconfigfile($configfilename, $configfilecontent);
+ return eval { output("$::prefix$configfilename", $configfilecontent) };
}
sub remove_printer_from_office {
@@ -160,13 +160,13 @@ sub remove_printer_from_office {
$configfilename =~ m!$suites{$suite}{file_name}!;
my $configprefix = $1;
# Load Star Office printer config file
- my $configfilecontent = readsofficeconfigfile($configfilename);
+ my $configfilecontent = cat_("$::prefix$configfilename");
# Remove the printer entry
$configfilecontent =
removestarofficeprinterentry($printer, $queue, $configprefix,
$configfilecontent);
# Write back Star Office configuration file
- return writesofficeconfigfile($configfilename, $configfilecontent);
+ return eval { output("$::prefix$configfilename", $configfilecontent) };
}
sub remove_local_printers_from_office {
@@ -177,14 +177,14 @@ sub remove_local_printers_from_office {
$configfilename =~ m!$suites{$suite}{file_name}!;
my $configprefix = $1;
# Load Star Office printer config file
- my $configfilecontent = readsofficeconfigfile($configfilename);
+ my $configfilecontent = cat_("$::prefix$configfilename");
# Remove the printer entries
foreach my $queue (keys(%{$printer->{configured}})) {
$configfilecontent =
removestarofficeprinterentry($printer, $queue, $configprefix, $configfilecontent);
}
# Write back Star Office configuration file
- return writesofficeconfigfile($configfilename, $configfilecontent);
+ return eval { output("$::prefix$configfilename", $configfilecontent) };
}
@@ -361,21 +361,8 @@ sub find_config_file {
return "";
}
-sub readsofficeconfigfile {
- my ($file) = @_;
- local *F;
- open F, "< $::prefix$file" or return "";
- my $filecontent = join("", <F>);
- close F;
- return $filecontent;
-}
-
sub writesofficeconfigfile {
my ($file, $filecontent) = @_;
- local *F;
- open F, "> $::prefix$file" or return 0;
- print F $filecontent;
- close F;
- return 1;
+ eval { output("$::prefix$file", $filecontent) };
}