POE::Filter::RecordBlock - translate between discrete records and blocks of them
Hello, dear reader. This SYNOPSIS does not contain a fully functioning sample program because your humble documenter cannot come up with a short, reasonable use case for this module. Please contact the maintainer if this module is useful to you. Otherwise you may wake up one morning to discover that it has been deprecated.
$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;
On input, POE::Filter::RecordBlock translates a stream of discrete items into a "block" of them. It does this by collecting items until it has BlockSize of them, then returning the lot of them in an array reference.
On output, this module flattens array references.
This module may be deprecated in the future. Please contact the maintainer if this module is useful to you.
In addition to the usual POE::Filter methods, POE::Filter::RecordBlock supports the following.
new() takes at least one mandatory argument, BlockSize, which must be defined and greater than zero. new() also accepts a CheckPut Boolean parameter that indicates whether put() should check for the proper BlockSize before allowing data to be serialized.
Using CheckPut is not recommended, as it enables a write buffer in the filter, therefore breaking put() for normal use.
put_pending() returns an arrayref of any records that are waiting to be sent. It is the outbound equivalent of POE::Filter's get_pending() accessor. put_pending() is not part of the canonical POE::Filter API, so nothing will use it. It's up to applications to handle pending output, whenever it's appropriate to do so.
blocksize() is an accessor/mutator for POE::Filter::RecordBlock's BlockSize value.
checkput() is an accessor/mutator for POE::Filter::RecordBlock's CheckPut flag.
POE::Filter for more information about filters in general.
POE::Filter::Stackable for more details on stacking filters.
This filter may maintain an output buffer that no other part of POE will know about.
This filter implements a highly specialized and seemingly not generally useful feature.
Does anyone use this filter? This filter may be deprecated if nobody speaks up.
The RecordBlock filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo.
Please see the POE manpage for more information about authors and contributors.
To install POE, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.