NAME

IOMux::Handler::Read - any mux reader

INHERITANCE

IOMux::Handler::Read
  is an IOMux::Handler

IOMux::Handler::Read is extended by
  IOMux::Bundle
  IOMux::File::Read
  IOMux::Net::TCP
  IOMux::Pipe::Read

SYNOPSIS

# only use extensions

DESCRIPTION

This base-class defines the interface which every reader offers.

Extends "DESCRIPTION" in IOMux::Handler.

METHODS

Extends "METHODS" in IOMux::Handler.

Constructors

Extends "Constructors" in IOMux::Handler.

IOMux::Handler::Read->new(%options)
-Option   --Defined in     --Default
 fh         IOMux::Handler   <required>
 name       IOMux::Handler   <stringified handle>
 read_size                   32768
fh => FILEHANDLE
name => STRING
read_size => INTEGER
IOMux::Handler::Read->open($mode, $what, %options)

Inherited, see "Constructors" in IOMux::Handler

Accessors

Extends "Accessors" in IOMux::Handler.

$obj->fh()

Inherited, see "Accessors" in IOMux::Handler

$obj->fileno()

Inherited, see "Accessors" in IOMux::Handler

$obj->mux()

Inherited, see "Accessors" in IOMux::Handler

$obj->name()

Inherited, see "Accessors" in IOMux::Handler

$obj->readSize( [$integer] )

The number of bytes requested at each read.

$obj->usesSSL()

Inherited, see "Accessors" in IOMux::Handler

User interface

Extends "User interface" in IOMux::Handler.

Connection

Extends "Connection" in IOMux::Handler.

$obj->close( [$callback] )

Inherited, see "Connection" in IOMux::Handler

$obj->timeout( [$timeout] )

Inherited, see "Connection" in IOMux::Handler

Reading

$obj->readline($callback)

Read a single line (bytes upto a LF or CRLF). After the whole line has arrived, the $callback will be invoked with the received line as parameter. that line is terminated by a LF (\n), even when the file contains CRLF or CR endings.

At end of file, the last fragment will be returned.

$obj->slurp($callback)

Read all remaining data from a resource. After everything has been read, it will be returned as SCALAR (string reference)

example:

my $pwd  = $mux->open('<', '/etc/passwd');
my $data = $pwd->slurp;
my $size = length $$data;

Multiplexer

Extends "Multiplexer" in IOMux::Handler.

Connection

Extends "Connection" in IOMux::Handler.

$obj->muxInit( $mux, [$handler] )

Inherited, see "Connection" in IOMux::Handler

$obj->muxRemove()

Inherited, see "Connection" in IOMux::Handler

$obj->muxTimeout()

Inherited, see "Connection" in IOMux::Handler

Reading

Extends "Reading" in IOMux::Handler.

$obj->muxEOF($input)

This is called when an end-of-file condition is present on the handle. Like muxInput(), it is also passed a reference to the input buffer. You should consume the entire buffer or else it will just be lost.

$obj->muxExceptFlagged($fileno)

Inherited, see "Reading" in IOMux::Handler

$obj->muxInput($buffer)

Called when new input has arrived on the input. It is passed a reference to the input $buffer. It must remove any input that it you have consumed from the $buffer, and leave any partially received data in there.

example:

sub muxInput
{   my ($self, $inbuf) = @_;

    # Process each whole line in the input, leaving partial
    # lines in the input buffer for more.
    while($$inbuf =~ s/^(.*?)\r?\n// )
    {   $self->process_command($1);
    }
}
$obj->muxReadFlagged($fileno)

Inherited, see "Reading" in IOMux::Handler

Writing

Extends "Writing" in IOMux::Handler.

$obj->muxWriteFlagged($fileno)

Inherited, see "Writing" in IOMux::Handler

Service

Extends "Service" in IOMux::Handler.

Helpers

Extends "Helpers" in IOMux::Handler.

$obj->extractSocket(HASH)
IOMux::Handler::Read->extractSocket(HASH)

Inherited, see "Helpers" in IOMux::Handler

$obj->fdset($state, $read, $write, $error)

Inherited, see "Helpers" in IOMux::Handler

$obj->show()

Inherited, see "Helpers" in IOMux::Handler

SEE ALSO

This module is part of IOMux distribution version 1.01, built on January 15, 2020. Website: http://perl.overmeer.net/CPAN

LICENSE

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/