1IPC::Filter(3pm) User Contributed Perl Documentation IPC::Filter(3pm)
2
3
4
6 IPC::Filter - filter data through an external process
7
9 use IPC::Filter qw(filter);
10
11 $compressed_data = filter($data, "bzip2");
12
14 The "filter" function provided by this module passes data through an
15 external command, thus providing filtering in non-pipeline situations.
16
18 filter(DATA, SHELL_COMMAND)
19 filter(DATA, PROGRAM, ARGS ...)
20 The SHELL_COMMAND, or the PROGRAM with ARGS if more arguments are
21 supplied, is executed as a separate process. (The arguments other
22 than DATA are ultimately passed to "exec"; see "exec" in
23 perlfunc(1) for explanation of the choice between the two forms.)
24 The DATA (which must be either a simple string or a reference to a
25 string) is supplied to the process on its standard input, and the
26 process's standard output is captured and returned (as a simple
27 string).
28
29 If the process exits with a non-zero exit code or on a signal, the
30 function will "die". In the case of a non-zero exit code, the
31 "die" message will duplicate the process's standard error output;
32 in any other case, the error output is discarded.
33
35 IPC::Open2
36
38 Andrew Main (Zefram) <zefram@fysh.org>
39
41 Copyright (C) 2004, 2007, 2010, 2011, 2017 Andrew Main (Zefram)
42 <zefram@fysh.org>
43
45 This module is free software; you can redistribute it and/or modify it
46 under the same terms as Perl itself.
47
48
49
50perl v5.38.0 2023-07-20 IPC::Filter(3pm)