jepri has asked for the wisdom of the Perl Monks concerning the following question:
But of course I want to do different things with the data based on what socket it came from. I can't use a reference as a hash key unless I use Tie::RefHash, which is not a standard module. So far I have managed to only use standard modules, and just to prove a point I would like to continue (and because my program is more portable if I stick to core modules). What's the best way to deal with it. I could create a hash and then check every key value to see if it has been returned, but that's kludgy and I'm not even sure it works:
{ 1 => $connection_handle_1, 2 => $connection_handle_2, 3 => $connection_handle_3 }
when I would rather have:
{ $connection_handle_1 => 1, $connection_handle_2 => 2, $connection_handle_3 => 3, }
The other option is to create an object for each socket (or rather, have the object create the socket) and then poll each object like $_->do_connection foreach @object. This doesn't sit very well with me because I'm wasting some of the power of IO::Select, but it's the solution I'm running with right now. Could someone set me straight please?
____________________
Jeremy
I didn't believe in evil until I dated it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Non blocking multiple socket handles as hash keys
by bikeNomad (Priest) on Jun 25, 2001 at 18:30 UTC | |
Re: Non blocking multiple socket handles as hash keys
by repson (Chaplain) on Jun 25, 2001 at 18:27 UTC |