Mark Overmeer > IOMux > IOMux::File::Read

Download:
IOMux-0.12.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.12   Source  

NAME ^

IOMux::File::Read - write to file

INHERITANCE ^

 IOMux::File::Read
   is a IOMux::Handler::Read
   is a IOMux::Handler

SYNOPSIS ^

  my $mux = IOMux::Select->new;  # or ::Poll

  use IOMux::Open '<';
  my $file = $mux->open('<', $filename);

  use IOMux::File::Read;
  my $file = IOMux::File::Read->new(file => $filename);
  $mux->add($file);

  $file->getline(sub {print "\n"});

DESCRIPTION ^

In an event driven program, reading is harder to use than writing: the read will very probably be stalled until data has arrived, so you will need a callback to handle the resulting data.

METHODS ^

Constructors

IOMux::File::Read->new(OPTIONS)
 -Option   --Defined in     --Default
  exclusive                   <false>
  fh         IOMux::Handler   <required>
  file                        <required>
  mode                        '<'
  modeflags                   <undef>
  name       IOMux::Handler   '<$file'
  read_size  IOMux::Handler::Read  32768
exclusive => BOOLEAN
fh => FILEHANDLE
file => FILENAME|HANDLE
mode => '<'

For now, the mode is always simply

modeflags => INTEGER

When defined, the exclusive option is not used, but your value is taken. Use constants defined by Fcntl. Do not forget to include O_NONBLOCK.

name => STRING
read_size => INTEGER
IOMux::File::Read->open(MODE, FILE, OPTIONS)

Accessors

$obj->fh See "Accessors" in IOMux::Handler
$obj->fileno See "Accessors" in IOMux::Handler
$obj->mode

The bits of the open mode.

$obj->mux See "Accessors" in IOMux::Handler
$obj->name See "Accessors" in IOMux::Handler
$obj->readSize([INTEGER]) See "Accessors" in IOMux::Handler::Read
$obj->usesSSL See "Accessors" in IOMux::Handler

User interface

Connection

$obj->close([CALLBACK]) See "Connection" in IOMux::Handler
$obj->timeout([TIMEOUT]) See "Connection" in IOMux::Handler

Reading

$obj->readline(CALLBACK) See "Reading" in IOMux::Handler::Read
$obj->slurp(CALLBACK) See "Reading" in IOMux::Handler::Read

Multiplexer

Connection

$obj->mux_init(MUX, [HANDLER]) See "Connection" in IOMux::Handler
$obj->mux_remove See "Connection" in IOMux::Handler
$obj->mux_timeout See "Connection" in IOMux::Handler

Reading

$obj->mux_eof(INPUT) See "Reading" in IOMux::Handler::Read
$obj->mux_except_flagged(FILENO) See "Reading" in IOMux::Handler
$obj->mux_input(BUFFER) See "Reading" in IOMux::Handler::Read
$obj->mux_read_flagged(FILENO) See "Reading" in IOMux::Handler

Writing

$obj->mux_write_flagged(FILENO) See "Writing" in IOMux::Handler

Service

Helpers

$obj->extractSocket(HASH)
IOMux::File::Read->extractSocket(HASH) See "Helpers" in IOMux::Handler
$obj->fdset(STATE, READ, WRITE, ERROR) See "Helpers" in IOMux::Handler
$obj->show See "Helpers" in IOMux::Handler

SEE ALSO ^

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

LICENSE ^

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

syntax highlighting: