summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-03 12:53:13 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-03 12:53:13 +0000
commitbc42f5ff04803ece22fd4f444f6b16c644c7d84a (patch)
tree10ecfc7c6b9eed6f5361506990d49353c066682a
parent7a352652b5b1a5711b1fd3e0a918f84ea6f1fc95 (diff)
downloaddrakx-bc42f5ff04803ece22fd4f444f6b16c644c7d84a.tar
drakx-bc42f5ff04803ece22fd4f444f6b16c644c7d84a.tar.gz
drakx-bc42f5ff04803ece22fd4f444f6b16c644c7d84a.tar.bz2
drakx-bc42f5ff04803ece22fd4f444f6b16c644c7d84a.tar.xz
drakx-bc42f5ff04803ece22fd4f444f6b16c644c7d84a.zip
(read_resolv_conf): simplify
-rw-r--r--perl-install/network/network.pm9
1 files changed, 2 insertions, 7 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 2f20d131a..a7994a18a 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -26,14 +26,9 @@ sub read_conf {
sub read_resolv_conf {
my ($file) = @_;
- my @l = qw(dnsServer dnsServer2 dnsServer3);
- my %netc;
+ my @l = map { if_(/^\s*nameserver\s+(\S+)/, $1) } cat_($file);
- local *F; open F, $file or die "cannot open $file: $!";
- local $_;
- while (<F>) {
- /^\s*nameserver\s+(\S+)/ and $netc{shift @l} = $1;
- }
+ my %netc = mapn { $_[0] => $_[1] } [ qw(dnsServer dnsServer2 dnsServer3) ], \@l;
\%netc;
}