GT::IPC::Filter::Block - Implements block based filtering for output streams.
use GT::IPC::Filter::Block;
my $filter = new GT::IPC::Filter::Block(
sub { my $block = shift ... }
);
# -or-
my $filter = new GT::IPC::Filter::Block(
output => sub { my $out = shift; .. },
block_size => 512 # Default
);
$filter->put(\$data);
$filter->flush;
Implements block based filtering to an output code reference. Used mainly in GT::IPC::Run, the GT::IPC::Run manpage for details.
There are three methods (as with all filters in this class).
Takes either a single argument, which is a code reference to call output with, or a hash of options.
This method takes a stream of data, it converted it into block based data using
the block_size you specified and passes each block to the code reference
specified by new(), see new. There is buffering that happens here.
This method should be called last, when the data stream is over. It flushes the remaining buffer out to the code reference.
Scott Beck
Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved. http://www.gossamer-threads.com/
Revision: $Id: Block.pm,v 1.7 2004/01/13 01:35:17 jagerman Exp $