use IO::Mux ; use IO::Mux::Select ;
my $mux = new IO::Mux(\*R) ; my $alice = $mux->new_handle() ; open($alice, 'alice') ; my $bob = $mux->new_handle() ; open($bob, 'bob') ;
my $ims = new IO::Mux::Select($alice, $bob) ; while(my @ready = $ims->can_read()){ foreach my $h (@ready){ # Do something useful... } }
IO::Mux::Select is a drop-in replacement for the IO::Select manpage that knows how
to deal with the IO::Mux::Handle manpage handles. It also supports real handles so
you can mix the IO::Mux::Handle manpage handles with real handles.
The constructor creates a new object and optionally initialises it with a set of handles.
The same interface as the IO::Select manpage is supported, with the following exceptions:
This method behaves pretty much like the the IO::Select manpage one, except it is not
guaranteed that it will return before TIMEOUT seconds. The reason for this is
that the the IO:Mux::Handle manpage objets handle data in packets, so if data is
"detected" on such a handle, can_read() must read the entire packet before
returning.
Not implemented.
Not implemented.
Not implemented.
Not implemented.
the IO::Select manpage, the IO::Mux manpage, the IO::Mux::Handle manpage
Patrick LeBoutillier, <patl@cpan.org>
Copyright (C) 2005 by Patrick LeBoutillier
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.