aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib
diff options
context:
space:
mode:
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r--SBO-Lib/lib/SBO/Lib/Util.pm23
1 files changed, 8 insertions, 15 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Util.pm b/SBO-Lib/lib/SBO/Lib/Util.pm
index 52b1a9d..efc40b6 100644
--- a/SBO-Lib/lib/SBO/Lib/Util.pm
+++ b/SBO-Lib/lib/SBO/Lib/Util.pm
@@ -354,23 +354,16 @@ There is no useful return value.
# subroutine to suck in config in order to facilitate unit testing
sub read_config {
- my %conf_values;
- if (-f $conf_file) {
- _race::cond('$conf_file might not exist after -f');
- my ($fh, $exit) = open_read($conf_file);
- if ($exit) {
- warn $fh;
- $config{SBO_HOME} = '/usr/sbo';
- return;
+ my $text = slurp($conf_file);
+ if (defined $text) {
+ my %conf_values = $text =~ /^(\w+)=(.*)$/mg;
+ for my $key (keys %config) {
+ $config{$key} = $conf_values{$key} if exists $conf_values{$key};
}
- my $text = do {local $/; <$fh>};
- %conf_values = $text =~ /^(\w+)=(.*)$/mg;
- close $fh;
- }
- for my $key (keys %config) {
- $config{$key} = $conf_values{$key} if exists $conf_values{$key};
+ $config{JOBS} = 'FALSE' unless $config{JOBS} =~ /^\d+$/;
+ } else {
+ warn "Unable to open $conf_file.\n";
}
- $config{JOBS} = 'FALSE' unless $config{JOBS} =~ /^\d+$/;
$config{SBO_HOME} = '/usr/sbo' if $config{SBO_HOME} eq 'FALSE';
}