POE::Filter::RecordBlock - POE Record Block Abstraction
$filter = new POE::Filter::RecordBlock( BlockSize => 4 ); $arrayref_of_arrayrefs = $filter->get($arrayref_of_raw_data); $arrayref_of_raw_chunks = $filter->put($arrayref_of_arrayrefs); $arrayref_of_raw_chunks = $filter->put($single_arrayref); $arrayref_of_leftovers = $filter->get_pending; $arrayref_of_leftovers = $filter->put_pending;
RecordBlock translates between streams of records and blocks of records. In other words, it combines a number of received records into frames (array references), and it breaks frames back into streams of records in preparation for transmitting.
A BlockSize parameter must be specified when the filter is constructed. It determines how many records are framed into a block, and it can be changed at runtime. Checking put() for proper block sizes is optional and can be either passed as a parameter to the new() method or changed at runtime.
Extra records are held until enough records arrive to complete a block.
The new() method takes at least one mandatory argument, the BlockSize parameter. It must be defined and greater than zero. The CheckPut parameter is optional, but if it contains a true value, "put" blocksize checking is turned on. Note that if this is the case, flushing pending records to be put is your responsibility (see put_pending()).
The put_pending() method returns an arrayref of any records that are waiting to be sent.
POE::Filter; POE::Filter::Stackable; POE::Filter::HTTPD; POE::Filter::Reference; POE::Filter::Line; POE::Filter::Block; POE::Filter::Stream
The RecordBlock filter was contributed by Dieter Pearcey. Rocco Caputo is sure to have had his hands in it.
Please see the POE manpage for more information about authors and contributors.