diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-03 13:09:55 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-03 13:09:55 +0000 |
commit | 8bd2384e3650933c8a17946a5a51e3c6e8529bce (patch) | |
tree | 16de244ce87fba0157310025da925c56b73d7c4e | |
parent | bc42f5ff04803ece22fd4f444f6b16c644c7d84a (diff) | |
download | drakx-8bd2384e3650933c8a17946a5a51e3c6e8529bce.tar drakx-8bd2384e3650933c8a17946a5a51e3c6e8529bce.tar.gz drakx-8bd2384e3650933c8a17946a5a51e3c6e8529bce.tar.bz2 drakx-8bd2384e3650933c8a17946a5a51e3c6e8529bce.tar.xz drakx-8bd2384e3650933c8a17946a5a51e3c6e8529bce.zip |
cleanup use of filehandles
-rw-r--r-- | perl-install/network/tools.pm | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 4d84c4baa..0c65bb854 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -143,11 +143,9 @@ sub connected_bg { local $| = 1; my ($ref) = @_; if (defined $kid_pipe) { - local *F; - *F = *$kid_pipe; - fcntl(F, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!"; + fcntl($kid_pipe, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!"; my $a; - if (defined($a = <F>)) { + if (defined($a = <$kid_pipe>)) { close($kid_pipe) || warn "kid exited $?"; undef $kid_pipe; $$ref = $a; @@ -176,16 +174,14 @@ sub test_connected { if ($cmd == 0) { if (defined $kid_pipe_connect) { - local *F; - *F = *$kid_pipe_connect; - fcntl(F, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!"; - my $a; - if (defined($a = <F>)) { - close($kid_pipe_connect) || warn "kid exited $?"; - undef $kid_pipe_connect; - undef $kid_pid; - $current_connection_status = $a; - } + fcntl($kid_pipe_connect, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!"; + my $a; + if (defined($a = <$kid_pipe_connect>)) { + close($kid_pipe_connect) || warn "kid exited $?"; + undef $kid_pipe_connect; + undef $kid_pid; + $current_connection_status = $a; + } } return $current_connection_status; } @@ -206,12 +202,11 @@ sub test_connected { } sub connected2 { - local *KID_TO_READ; - my $pid = open(KID_TO_READ, "-|"); - if ($pid) { # parent - $kid_pid = $pid; - return *KID_TO_READ; - } else { # child + if ($kid_pid = open(my $kid_to_read, "-|")) { + #- parent + $kid_to_read; + } else { + #- child my $a = gethostbyname("mandrakesoft.com") ? 1 : 0; print $a; c::_exit(0); |