
IOMux::Handler::Read - any mux reader

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

# only use extensions

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

-Option --Defined in --Default fh IOMux::Handler <required> name IOMux::Handler <stringified handle> read_size 32768
The number of bytes requested at each read.
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.
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;
This is called when an end-of-file condition is present on the handle. Like mux_input(), it is also passed a reference to the input buffer. You should consume the entire buffer or else it will just be lost.
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 mux_input
{ 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);
}
}

This module is part of IOMux distribution version 0.12, built on January 27, 2011. Website: http://perl.overmeer.net/ All modules in this suite: "Any::Daemon", "IOMux", and "IOMux::HTTP".
Please post questions or ideas to perl@overmeer.net

Copyrights 2011 by Mark Overmeer. 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://www.perl.com/perl/misc/Artistic.html