chanson has asked for the wisdom of the Perl Monks concerning the following question:
I am using a IO::Select object to manage multiple network connections. Currenty I am having trouble removing a socket from my select. If I run the following code:
I get the following expected output:#!/usr/bin/perl use IO::Select; use Data::Dumper; $sel = IO::Select->new(STDIN, STDOUT, STDERR); @hand = $sel->handles(); print Dumper \@hand; $sel->remove(STDIN); @hand = $sel->handles(); print Dumper \@hand;
In my system I have a little method called remove socket.$VAR1 = [ 'STDIN', 'STDOUT', 'STDERR' ]; $VAR1 = [ 'STDOUT', 'STDERR' ];
Which gives the following, and in my mind very confusing, output when run in the larger system:sub removeSocket { my ($self, $socket) = @_; my $select = $self->{'select'}; print STDERR 'dumping: ',Dumper $socket; my @handles = $select->handles(); print STDERR '>>before: ',Dumper \@handles; my $retVal = $select->remove($socket); print STDERR $retVal, $/; my @handles2 = $select->handles(); print STDERR '>>after: ',Dumper \@handles2; }
Any thoughts? Thanks in advance. (btw although I have been a perl programmer for 5 years I have not done a lot of socket programming, and also have not spent any time on perlmonks)dumping: $VAR1 = \bless( \*Symbol::GEN1, 'IO::Socket::INET' ); >>before: $VAR1 = [ bless( \*Symbol::GEN0, 'IO::Socket::INET' ), bless( \*Symbol::GEN1, 'IO::Socket::INET' ) ]; 0 >>after: $VAR1 = [ bless( \*Symbol::GEN0, 'IO::Socket::INET' ), bless( \*Symbol::GEN1, 'IO::Socket::INET' ) ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Select behavior
by pg (Canon) on Mar 13, 2003 at 20:44 UTC |