IOMux::Select - simplify use of select()
IOMux::Select is an IOMux
use IOMux::Select; my $mux = IOMux::Select->new; my $server = IOMux::Service::TCP->new(...); $mux->add($server); $mux->loop;
Multiplexer implemented around the select() system call. This select() is usually less powerful and slower than the poll() call (implemented in IOMux::Poll) however probably available on more systems.
select()
poll()
Extends "DESCRIPTION" in IOMux.
Extends "METHODS" in IOMux.
Extends "Constructors" in IOMux.
Inherited, see "Constructors" in IOMux
Extends "Accessors" in IOMux.
Extends "User interface" in IOMux.
Inherited, see "User interface" in IOMux
Display the select $flags (one of the values received from selectFlags()) or all of these flags. You may also specify three sets of $flags explicitly.
When three sets of $flags are passed, it will result in three lines preceeded with labels. With only one set, no label will be used.
The flagged filenos are shown numerically (modulo 10) and positionally. For instance, if both filehandle 1 and 4 are flagged, the output string will be -1--4.
-1--4
example:
my ($rd, $wr, $er) = $client->selectFlags; print "read flags: ",$client->showFlags($rd); print $client->showFlags(rd, $wr, $er); print $client->showFlags; # saem result print $client->showFlags($client->waitFlags);
Extends "For internal use" in IOMux.
Inherited, see "For internal use" in IOMux
Returns a list of three: respectively the read, write and error flags which show the file numbers that the internal select() call has flagged as needing inspection.
This method can, for instance, be used from within the heartbeat routine.
$mux->loop(\&heartbeat); sub heartbeat($$$) { my ($mux, $numready, $timeleft) = @_; my ($rd, $rw, $ex) = $mux->selectFlags; if(vec($rd, $fileno, 1)==1) {...} }
Returns a list of three: respectively the read, write and error flags which show how the files are enlisted.
Extends "DETAILS" in IOMux.
Extends "Installation" in IOMux.
Extends "Event managers" in IOMux.
Extends "File handles" in IOMux.
The select system call is very powerful, however the (UNIX) standard specifies quite a weak subset of the features usually offered. The standard only requires sockets to be supported. The Windows/cygwin implementation limits itself to that. Modern UNIX dialects usually also support normal pipes and file handlers to be attached.
select
Please help extending the list of OS specific limitations below!
The select() system call is very limited: it only works on sockets, not on files or pipes. This means that the process will stall on each file access and pipe activity.
Be careful with the use of files. You should open files with the non-stdio version of open(), with option O_NONBLOCK. But even then, asynchronous support for reading and writing files and pipes may be lacking on your UNIX dialect.
open()
O_NONBLOCK
This module is part of IOMux distribution version 1.01, built on January 15, 2020. Website: http://perl.overmeer.net/CPAN
Copyrights 2011-2020 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
To install IOMux, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IOMux
CPAN shell
perl -MCPAN -e shell install IOMux
For more information on module installation, please visit the detailed CPAN module installation guide.