in reply to Sockets/filehandles as hash key?
Here, I'm storing the data in %kids where the key is some identifier (actually, the kid's PID) and a bunch of correlated values as an array(ref). One of those values (at index 1) is the handle to watch for reading. I construct the IO::Select on the fly, and when it returns one or more $ready values, I simply perform == to see which one of those handles it originally was, which gives me all the other correlated data as well.for my $ready (IO::Select->new(map $_->[1], values %kids)->can_r +ead(1)) { my ($kid) = grep $kids{$_}[1] == $ready, keys %kids; ## ... use $kids{$kid}[0], $kids{$kid}[2] etc. }
-- Randal L. Schwartz, Perl hacker
|
|---|