- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS

- new
- put
- flush

- SEE ALSO
- MAINTAINER
- COPYRIGHT
- VERSION

# NAME

GT::IPC::Filter::Block - Implements block based filtering for output streams.

# SYNOPSIS

        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;

# DESCRIPTION

Implements block based filtering to an output code reference. Used mainly in GT::IPC::Run, the GT::IPC::Run manpage for details.

# METHODS

There are three methods (as with all filters in this class).

## new

Takes either a single argument, which is a code reference to call output with, or a hash of options.

output

  This is the code reference you would like called with each block of output. The blocks are stripped of there ending before this is called.

block_size

  This is the size of chunks of data you want your code reference called with. It defaults to 512.

## put

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.

## flush

This method should be called last, when the data stream is over. It flushes the remaining buffer out to the code reference.

# SEE ALSO

See the GT::IPC::Run manpage.

# MAINTAINER

Scott Beck

# COPYRIGHT

Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved. http://www.gossamer-threads.com/

# VERSION

Revision: $Id: Block.pm,v 1.7 2004/01/13 01:35:17 jagerman Exp $