Dear Monks,
I'm using IO::Select in order to switch between different clients connected to the same server program. At first, I used a sample code to understand how IO::Select works. That code uses the select() method in order to find the clients that have produced some output, like this:
$read_set = new IO::Select(); # create handle set for reading $read_set->add($socket); # add the main socket to the set # Get a set of readable handles (blocks until at least one handle is r +eady) my ($rh_set) = IO::Select->select($read_set, undef, undef, 0);
Now, after reading the module's documentation, I'm trying to understand what's the difference between using can_read() and select(). Can the last line in the above extract be written as my @rh_set = $read_set->can_read(); ?
I can see that one method is static whole the other is not, and that one returns references to arrays, while the second returns one array - but are there any differences in the results themselves? Is one of them somehow "better" to use than the other?
Thanks a lot!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |