in reply to Re: Difference between can_read() and select() in IO::Select
in thread Difference between can_read() and select() in IO::Select
No, they're not the same.
my ($rh_set) = IO::Select->select($read_set, undef, undef, 0);
is actually equivalent to
my @rh_set = $read_set->can_read(0);
These are non-blocking.
my @rh_set = $read_set->can_read();
and
my @rh_set = $read_set->can_read(undef);
block just like
my ($rh_set) = IO::Select->select($read_set, undef, undef);
and
my ($rh_set) = IO::Select->select($read_set, undef, undef, undef);
To the OP, can_read is just a thin wrapper around IO::Select::select that saves you from specifying undefs and dealing with the more complex return value.
|
|---|