IOMux
view release on metacpan or search on metacpan
examples/echo-daemon.pl view on Meta::CPAN
use Log::Report;
use Any::Daemon;
#use IOMux::Select;
use IOMux::Poll;
use IOMux::Service::TCP;
use Getopt::Long qw/GetOptions :config no_ignore_case bundling/;
use File::Basename qw/basename/;
#use IO::Socket::SSL; # when SSL is used anywhere
#
## get command-line options
#
my $mode = 0; # increase output
my %os_opts =
( pid_file => basename($0). '.pid' # usually in /var/run
, user => undef
lib/IOMux/Handler.pm view on Meta::CPAN
sub new(@) {my $class = shift; (bless {}, $class)->init( {@_} ) }
sub init($)
{ my ($self, $args) = @_;
return $self if $self->{IH_name}; # already initialized
my $name = $self->{IH_name} = $args->{name} || "$self";
if(my $fh = $self->{IH_fh} = $args->{fh})
{ $self->{IH_fileno} = $fh->fileno;
$self->{IH_uses_ssl} = UNIVERSAL::isa($fh, 'IO::Socket::SSL');
}
$self;
}
sub open() {panic}
#-------------------------
sub name() {shift->{IH_name}}
lib/IOMux/Handler.pm view on Meta::CPAN
push @sockopts, $_ => $args->{$_}
for grep /^[A-Z]/, keys %$args;
@sockopts
or error __x"pass socket or provide parameters to create one for {pkg}"
, pkg => $class;
my $ssl = delete $args->{use_ssl};
# the extension will load these classes
my $make = $ssl ? 'IO::Socket::SSL' : 'IO::Socket::INET';
$socket = $make->new(@sockopts)
or fault __x"cannot create {pkg} socket", pkg => $class;
$socket;
}
1;
lib/IOMux/Handler.pod view on Meta::CPAN
use_ssl <false>
=over 2
=item socket => IO::Socket object
You may pre-initialize an IO::Socket.
=item use_ssl => BOOLEAN
When true, a IO::Socket::SSL object will be created, otherwise a
IO::Socket::INET object.
=back
=item $obj-E<gt>B<fdset>($state, $read, $write, $error)
Change the flags for the $read, $write and/or $error acceptance by the
mux to $state.
=item $obj-E<gt>B<show>()
( run in 0.523 second using v1.01-cache-2.11-cpan-4d50c553e7e )