POE::Driver - an abstract file driver
$driver = POE::Driver::Something->new(); $arrayref_of_data_chunks = $driver->get($filehandle); $queue_octets = $driver->put($arrayref_of_data_chunks); $queue_octets = $driver->flush($filehandle); $queue_messages = $driver->get_out_messages_buffered();
Drivers implement generic interfaces to low-level file I/O. Wheels use them to read and write files, sockets, and other things without needing to know the details for doing so.
These methods are the generic Driver interface, and every driver must implement them. Specific drivers may have additional methods.
new() creates and initializes a new driver. Specific drivers may have different constructor parameters.
get() immediately tries to read information from a filehandle. It returns a reference to an array containing whatever it managed to read, or an empty array if nothing could be read. It returns undef on error, and $! will be set.
The arrayref get() returns is suitable for passing to any POE::Filter's get() method. This is exactly what the ReadWrite wheel does with it.
put() places raw data chunks into the driver's output queue. it accepts a reference to a list of raw data chunks, and it returns the number of octets remaining in its output queue.
Some drivers may flush data immediately from their put() methods.
flush() attempts to flush some data from the driver's output queue to the FILEHANDLE. It returns the number of octets remaining in the output queue after the flush attempt.
flush() does the physical write, counterpoint to get's read. If flush() fails for any reason, $! will be set with the reason for its failure. Otherwise $! will be zero.
This data accessor returns the number of messages in the driver's output queue. Partial messages are counted as whole ones.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
There is no POE::Driver::SendRecv, but nobody has needed one so far.
In theory, drivers should be pretty much interchangeable. In practice, there seems to be an impermeable barrier between the different SOCK_* types.
Please see POE for more information about authors and contributors.
To install POE::Driver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Driver
CPAN shell
perl -MCPAN -e shell install POE::Driver
For more information on module installation, please visit the detailed CPAN module installation guide.