diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-06 22:52:57 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-06 22:52:57 +0000 |
commit | 8cb21146557a468e517db3123d481e5715971c7a (patch) | |
tree | 757b85c18f3a46f1ce331891e7f7aaf98a8b6702 /perl-install/network | |
parent | d3271db5a1609ee14b6f3a57aed7925644a5dabe (diff) | |
download | drakx-backup-do-not-use-8cb21146557a468e517db3123d481e5715971c7a.tar drakx-backup-do-not-use-8cb21146557a468e517db3123d481e5715971c7a.tar.gz drakx-backup-do-not-use-8cb21146557a468e517db3123d481e5715971c7a.tar.bz2 drakx-backup-do-not-use-8cb21146557a468e517db3123d481e5715971c7a.tar.xz drakx-backup-do-not-use-8cb21146557a468e517db3123d481e5715971c7a.zip |
- have "local *FILEHANDLE" before each "open FILEHANDLE, ..."
- use some "cat_" and "output" where possible
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/network.pm | 14 | ||||
-rw-r--r-- | perl-install/network/tools.pm | 1 |
2 files changed, 6 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; diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index dba446beb..2b9a4448f 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -207,6 +207,7 @@ sub test_connected { } sub connected2 { + local *KID_TO_READ; my $pid = open(KID_TO_READ, "-|"); if ($pid) { # parent $kid_pid = $pid; |