The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POE::Driver - perform IO on a filehandle

SYNOPSIS

  $driver = new POE::Driver::Derivative(); # create a derivative driver
  \@input_chunks = $driver->get($handle);  # get data from $handle
  $result = $driver->put($output_chunk);   # put data into an output buffer
  $result = $driver->flush($handle);       # flush output buffer to $handle

DESCRIPTION

Derivatives of POE::Driver provide standard IO functions for their parent IO::Sessions. For example, POE::Driver::SysRW provides basic sysread and syswrite, with buffering and error checking.

PUBLIC METHODS

new POE::Driver::Derivative

Creates and returns a reference to a new POE::Driver derivative.

$driver->put($output)

Adds $output to the driver's output buffer. See $driver-flush(...)> to find out what happens next. Returns the amount of data in the driver's output buffer after $output has been added.

$driver->get($handle)

Extracts data from a filehandle. On success, it returns a reference to an array of extracted chunks of information. On failure, it sets $! and returns undef. Some drivers may absorb EAGAIN.

$driver->flush($handle)

Attempts to write to $handle a chunk of information buffered by $driver-put(...)>. On success, it returns the amount of data waiting to be written. On failure, it returns undef and sets $!. Some drivers may absorb EAGAIN.

EXAMPLES

Please see tests/selects.perl for an example of POE::Driver derivatives.

BUGS

None known.

CONTACT AND COPYRIGHT

Copyright 1998 Rocco Caputo <troc@netrus.net>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.