POE::Filter::Block - filter between streams and blocks
$filter = POE::Filter::Block->new( BlockSize => 1024 ); $arrayref_of_blocks = $filter->get($arrayref_of_raw_chunks_from_driver); $arrayref_of_streamable_chunks_for_driver = $filter->put($arrayref_of_blocks); $arrayref_of_leftovers = $filter->get_pending();
The Block filter translates data between serial streams and blocks. It can handle two kinds of block: fixed-length and length-prepended.
Fixed-length blocks are used when Block's constructor is given a block size. Otherwise the Block filter uses length-prepended blocks.
Users who specify block sizes less than one deserve to be soundly spanked.
Extra bytes are buffered until more bytes arrive to complete a block.
Please see POE::Filter.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
The put() method doesn't verify block sizes.
The Block filter was contributed by Dieter Pearcey, with changes by Rocco Caputo.
Please see POE for more information about authors and contributors.