summaryrefslogtreecommitdiffstats
path: root/perl-install/network/network.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-06 22:52:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-06 22:52:57 +0000
commit8cb21146557a468e517db3123d481e5715971c7a (patch)
tree757b85c18f3a46f1ce331891e7f7aaf98a8b6702 /perl-install/network/network.pm
parentd3271db5a1609ee14b6f3a57aed7925644a5dabe (diff)
downloaddrakx-8cb21146557a468e517db3123d481e5715971c7a.tar
drakx-8cb21146557a468e517db3123d481e5715971c7a.tar.gz
drakx-8cb21146557a468e517db3123d481e5715971c7a.tar.bz2
drakx-8cb21146557a468e517db3123d481e5715971c7a.tar.xz
drakx-8cb21146557a468e517db3123d481e5715971c7a.zip
- have "local *FILEHANDLE" before each "open FILEHANDLE, ..."
- use some "cat_" and "output" where possible
Diffstat (limited to 'perl-install/network/network.pm')
-rw-r--r--perl-install/network/network.pm14
1 files changed, 5 insertions, 9 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index ceb9f4314..8b7fb7ce0 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -146,17 +146,13 @@ sub add2hosts {
my %l;
$l{$_} = $hostname foreach @ips;
- local *F;
- if (-e $file) {
- open F, $file or die "cannot open $file: $!";
- #/\s*(\S+)(.*)/ and $l{$1} ||= $2 foreach <F>;
- foreach (<F>) {
- m/\s*(\S+)(.*)/;
- my ($ip, $host) = ($1, $2);
- $l{$ip} ||= $host if $host !~ /^\s*$hostname\s*$/;
- }
+ foreach (cat_($file)) {
+ m/\s*(\S+)(.*)/;
+ my ($ip, $host) = ($1, $2);
+ $l{$ip} ||= $host if $host !~ /^\s*$hostname\s*$/;
}
log::l("writing host information to $file");
+ local *F;
open F, ">$file" or die "cannot write $file: $!";
while (my ($ip, $v) = each %l) {
$ip or next;