SYNOPSIS

        use IPC::Filter qw(filter);

        $compressed_data = filter($data, "bzip2");

DESCRIPTION

The \*(C`filter\*(C' function provided by this module passes data through an external command, thus providing filtering in non-pipeline situations.

FUNCTIONS

filter(\s-1DATA\s0, \s-1SHELL_COMMAND\s0)
filter(\s-1DATA\s0, \s-1PROGRAM\s0, \s-1ARGS\s0 ...)

The \s-1SHELL_COMMAND\s0, or the \s-1PROGRAM\s0 with \s-1ARGS\s0 if more arguments are supplied, is executed as a separate process. (The arguments other than \s-1DATA\s0 are ultimately passed to \*(C`exec\*(C'; see \*(L"exec\*(R" in perlfunc\|(1) for explanation of the choice between the two forms.) The \s-1DATA\s0 (which must be either a simple string or a reference to a string) is supplied to the process on its standard input, and the process's standard output is captured and returned (as a simple string). If the process exits with a non-zero exit code or on a signal, the function will \*(C`die\*(C'. In the case of a non-zero exit code, the \*(C`die\*(C' message will duplicate the process's standard error output; in any other case, the error output is discarded.

RELATED TO IPC::Filter…

IPC::Open2

AUTHOR

Andrew Main (Zefram) <[email protected]>

COPYRIGHT

Copyright (C) 2004, 2007, 2010, 2011 Andrew Main (Zefram) <[email protected]>

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.