---
name: "IPC::Filter"
section: "3pm"
platform: "linux"
package: "libipc-filter-perl"
version: "0.005-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/IPC::Filter"
---

# IPC::Filter(3pm)

filter data through an external process

## NAME

IPC::Filter - filter data through an external process

## SYNOPSIS

```
    use IPC::Filter qw(filter);
    $compressed_data = filter($data, "bzip2");
```

## DESCRIPTION

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

## FUNCTIONS

- filter(DATA, SHELL\_COMMAND)

  - filter(DATA, PROGRAM, ARGS ...)

  The SHELL\_COMMAND, or the PROGRAM with ARGS if more arguments are supplied, is executed as a separate process.  (The arguments other than DATA are ultimately passed to `"exec"`; see "exec" in [**perlfunc**(1)](/perlfunc/1.md) for explanation of the choice between the two forms.)  The DATA (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 `"die"`.  In the case of a non-zero exit code, the `"die"` message will duplicate the process's standard error output; in any other case, the error output is discarded.

## SEE ALSO

IPC::Open2

## AUTHOR

Andrew Main (Zefram) \<zefram@fysh.org\>

## COPYRIGHT

Copyright (C) 2004, 2007, 2010, 2011, 2017 Andrew Main (Zefram) \<zefram@fysh.org\>

## LICENSE

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