{"id":7188,"date":"2022-12-20T19:35:45","date_gmt":"2022-12-20T22:35:45","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/ipcrun3-man3\/"},"modified":"2022-12-20T19:35:45","modified_gmt":"2022-12-20T22:35:45","slug":"ipcrun3-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/ipcrun3-man3\/","title":{"rendered":"IPC::Run3 (man3)"},"content":{"rendered":"<h1 align=\"center\">IPC::Run3<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#HOW IT WORKS\">HOW IT WORKS<\/a><br \/> <a href=\"#LIMITATIONS\">LIMITATIONS<\/a><br \/> <a href=\"#DEBUGGING\">DEBUGGING<\/a><br \/> <a href=\"#PROFILING\">PROFILING<\/a><br \/> <a href=\"#COMPARISON\">COMPARISON<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a><br \/> <a href=\"#LICENSE\">LICENSE<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">IPC::Run3 \u2212 run a subprocess with input\/ouput redirection<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">version 0.048<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use IPC::Run3; # Exports run3() by default <br \/> run3 @cmd, $in, $out, $err;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module allows you to run a subprocess and redirect stdin, stdout, and\/or stderr to files and perl data structures. It aims to satisfy 99% of the need for using &#8220;system&#8221;, &#8220;qx&#8221;, and &#8220;open3&#8221; with a simple, extremely Perlish <small>API.<\/small><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Speed, simplicity, and portability are paramount. (That\u2019s speed of Perl code; which is often much slower than the kind of buffered I\/O that this module uses to spool input to and output from the child command.)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>&#8220;run3($cmd, $stdin, $stdout, $stderr, %options)&#8221;<\/b> <br \/> All parameters after $cmd are optional.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The parameters $stdin, $stdout and $stderr indicate how the child\u2019s corresponding filehandle (&#8220;STDIN&#8221;, &#8220;STDOUT&#8221; and &#8220;STDERR&#8221;, resp.) will be redirected. Because the redirects come last, this allows &#8220;STDOUT&#8221; and &#8220;STDERR&#8221; to default to the parent\u2019s by just not specifying them &#8212; a common use case.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">&#8220;run3&#8221; throws an exception if the wrapped &#8220;system&#8221; call returned \u22121 or anything went wrong with &#8220;run3&#8243;\u2019s processing of filehandles. Otherwise it returns true. It leaves $? intact for inspection of exit and wait status.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Note that a true return value from &#8220;run3&#8221; doesn\u2019t mean that the command had a successful exit code. Hence you should always check $?.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">See &#8220;%options&#8221; for an option to handle the case of &#8220;system&#8221; returning \u22121 yourself.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$cmd<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Usually $cmd will be an <small>ARRAY<\/small> reference and the child is invoked via<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">system @$cmd;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">But $cmd may also be a string in which case the child is invoked via<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">system $cmd;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">(cf. &#8220;system&#8221; in perlfunc for the difference and the pitfalls of using the latter form).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$stdin, $stdout, $stderr<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The parameters $stdin, $stdout and $stderr can take one of the following forms: <br \/> &#8220;undef&#8221; (or not specified at all)<\/p>\n<p style=\"margin-left:17%;\">The child inherits the corresponding filehandle from the parent.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">run3 @cmd, $stdin; # child writes to same STDOUT and STDERR as parent <br \/> run3 @cmd, undef, $stdout, $stderr; # child reads from same STDIN as parent<\/p>\n<p style=\"margin-left:11%;\">&#8220;undef&#8221;<\/p>\n<p style=\"margin-left:17%;\">The child\u2019s filehandle is redirected from or to the local equivalent of &#8220;\/dev\/null&#8221; (as returned by &#8220;File::Spec\u2212>devnull()&#8221;).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">run3 @cmd, undef, $stdout, $stderr; # child reads from \/dev\/null<\/p>\n<p style=\"margin-left:11%;\">a simple scalar<\/p>\n<p style=\"margin-left:17%;\">The parameter is taken to be the name of a file to read from or write to. In the latter case, the file will be opened via<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">open FH, &#8220;>&#8221;, &#8230;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">i.e. it is created if it doesn\u2019t exist and truncated otherwise. Note that the file is opened by the parent which will croak in case of failure.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">run3 @cmd, undef, &#8220;out.txt&#8221;; # child writes to file &#8220;out.txt&#8221;<\/p>\n<p style=\"margin-left:11%;\">a filehandle (either a reference to a <small>GLOB<\/small> or an &#8220;IO::Handle&#8221;)<\/p>\n<p style=\"margin-left:17%;\">The filehandle is inherited by the child.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">open my $fh, &#8220;>&#8221;, &#8220;out.txt&#8221;; <br \/> print $fh &#8220;prologuen&#8221;; <br \/> &#8230; <br \/> run3 @cmd, undef, $fh; # child writes to $fh <br \/> &#8230; <br \/> print $fh &#8220;epiloguen&#8221;; <br \/> close $fh;<\/p>\n<p style=\"margin-left:11%;\">a <small>SCALAR<\/small> reference<\/p>\n<p style=\"margin-left:17%;\">The referenced scalar is treated as a string to be read from or written to. In the latter case, the previous content of the string is overwritten.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">my $out; <br \/> run3 @cmd, undef, $out; # child writes into string <br \/> run3 @cmd, <<EOF; # child reads from string (can use \"here\" notation) <br \/> Input <br \/> to <br \/> child <br \/> EOF<\/p>\n<p style=\"margin-left:11%;\">an <small>ARRAY<\/small> reference<\/p>\n<p style=\"margin-left:17%;\">For $stdin, the elements of @$stdin are simply spooled to the child.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">For $stdout or $stderr, the child\u2019s corresponding file descriptor is read line by line (as determined by the current setting of $\/) into @$stdout or @$stderr, resp. The previous content of the array is overwritten.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">my @lines; <br \/> run3 @cmd, undef, @lines; # child writes into array<\/p>\n<p style=\"margin-left:11%;\">a <small>CODE<\/small> reference<\/p>\n<p style=\"margin-left:17%;\">For $stdin, &#038;$stdin will be called repeatedly (with no arguments) and the return values are spooled to the child. &#038;$stdin must signal the end of input by returning &#8220;undef&#8221;.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">For $stdout or $stderr, the child\u2019s corresponding file descriptor is read line by line (as determined by the current setting of $\/) and &#038;$stdout or &#038;$stderr, resp., is called with the contents of the line. Note that there\u2019s no end-of-file indication.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">my $i = 0; <br \/> sub producer { <br \/> return $i < 10 ? \"line\".$i++.\"n\" : undef; <br \/> } <br \/> run3 @cmd, &producer; # child reads 10 lines<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Note that this form of redirecting the child\u2019s I\/O doesn\u2019t imply any form of concurrency between parent and child \u2212 <b>run3()<\/b>\u2019s method of operation is the same no matter which form of redirection you specify.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the same value is passed for $stdout and $stderr, then the child will write both &#8220;STDOUT&#8221; and &#8220;STDERR&#8221; to the same filehandle. In general, this means that<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">run3 @cmd, undef, &#8220;foo.txt&#8221;, &#8220;foo.txt&#8221;; <br \/> run3 @cmd, undef, $both, $both;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">will <small>DWIM<\/small> and pass a single file handle to the child for both &#8220;STDOUT&#8221; and &#8220;STDERR&#8221;, collecting all into file &#8220;foo.txt&#8221; or $both.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>&#8220;%options&#8221;<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The last parameter, &#8220;%options&#8221;, must be a hash reference if present.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Currently the following keys are supported: <br \/> &#8220;binmode_stdin&#8221;, &#8220;binmode_stdout&#8221;, &#8220;binmode_stderr&#8221;<\/p>\n<p style=\"margin-left:17%;\">The value must a &#8220;layer&#8221; as described in &#8220;binmode&#8221; in perlfunc. If specified the corresponding parameter $stdin, $stdout or $stderr, resp., operates with the given layer.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">For backward compatibility, a true value that doesn\u2019t start with &#8220;:&#8221; (e.g. a number) is interpreted as &#8220;:raw&#8221;. If the value is false or not specified, the default is &#8220;:crlf&#8221; on Windows and &#8220;:raw&#8221; otherwise.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Don\u2019t expect that values other than the built-in layers &#8220;:raw&#8221;, &#8220;:crlf&#8221;, and (on newer Perls) &#8220;:bytes&#8221;, &#8220;:utf8&#8221;, &#8220;:encoding(&#8230;)&#8221; will work.<\/p>\n<p style=\"margin-left:11%;\">&#8220;append_stdout&#8221;, &#8220;append_stderr&#8221;<\/p>\n<p style=\"margin-left:17%;\">If their value is true then the corresponding parameter $stdout or $stderr, resp., will append the child\u2019s output to the existing &#8220;contents&#8221; of the redirector. This only makes sense if the redirector is a simple scalar (the corresponding file is opened in append mode), a <small>SCALAR<\/small> reference (the output is appended to the previous contents of the string) or an <small>ARRAY<\/small> reference (the output is &#8220;push&#8221;ed onto the previous contents of the array).<\/p>\n<p style=\"margin-left:11%;\">&#8220;return_if_system_error&#8221;<\/p>\n<p style=\"margin-left:17%;\">If this is true &#8220;run3&#8221; does <b>not<\/b> throw an exception if &#8220;system&#8221; returns \u22121 (cf. &#8220;system&#8221; in perlfunc for possible failure scenarios.), but returns true instead. In this case $? has the value \u22121 and $! contains the errno of the failing &#8220;system&#8221; call.<\/p>\n<h2>HOW IT WORKS <a name=\"HOW IT WORKS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\">(1)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">For each redirector $stdin, $stdout, and $stderr, &#8220;run3()&#8221; furnishes a filehandle:<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">\u2022<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"5%\"><\/td>\n<td width=\"77%\">\n<p style=\"margin-top: 1em\">if the redirector already specifies a filehandle it just uses that<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"77%\">\n<p>if the redirector specifies a filename, &#8220;run3()&#8221; opens the file in the appropriate mode<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"77%\">\n<p>in all other cases, &#8220;run3()&#8221; opens a temporary file (using tempfile)<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p>(2)<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"77%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">If &#8220;run3()&#8221; opened a temporary file for $stdin in step (1), it writes the data using the specified method (either from a string, an array or returned by a function) to the temporary file and rewinds it.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\">(3)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">&#8220;run3()&#8221; saves the parent\u2019s &#8220;STDIN&#8221;, &#8220;STDOUT&#8221; and &#8220;STDERR&#8221; by duplicating them to new filehandles. It duplicates the filehandles from step (1) to &#8220;STDIN&#8221;, &#8220;STDOUT&#8221; and &#8220;STDERR&#8221;, resp.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>(4)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>&#8220;run3()&#8221; runs the child by invoking system with $cmd as specified above.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>(5)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>&#8220;run3()&#8221; restores the parent\u2019s &#8220;STDIN&#8221;, &#8220;STDOUT&#8221; and &#8220;STDERR&#8221; saved in step (3).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>(6)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>If &#8220;run3()&#8221; opened a temporary file for $stdout or $stderr in step (1), it rewinds it and reads back its contents using the specified method (either to a string, an array or by calling a function).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>(7)<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>&#8220;run3()&#8221; closes all filehandles that it opened explicitly in step (1).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Note that when using temporary files, &#8220;run3()&#8221; tries to amortize the overhead by reusing them (i.e. it keeps them open and rewinds and truncates them before the next operation).<\/p>\n<h2>LIMITATIONS <a name=\"LIMITATIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Often uses intermediate files (determined by File::Temp, and thus by the File::Spec defaults and the <small>TMPDIR<\/small> env. variable) for speed, portability and simplicity.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Use extreme caution when using &#8220;run3&#8221; in a threaded environment if concurrent calls of &#8220;run3&#8221; are possible. Most likely, I\/O from different invocations will get mixed up. The reason is that in most thread implementations all threads in a process share the same <small>STDIN\/STDOUT\/STDERR.<\/small> Known failures are Perl ithreads on Linux and Win32. Note that &#8220;fork&#8221; on Win32 is emulated via Win32 threads and hence I\/O mix up is possible between forked children here (&#8220;run3&#8221; is &#8220;fork safe&#8221; on Unix, though).<\/p>\n<h2>DEBUGGING <a name=\"DEBUGGING\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">To enable debugging use the <small>IPCRUN3DEBUG<\/small> environment variable to a non-zero integer value:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">$ IPCRUN3DEBUG=1 myapp<\/p>\n<h2>PROFILING <a name=\"PROFILING\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">To enable profiling, set <small>IPCRUN3PROFILE<\/small> to a number to enable emitting profile information to <small>STDERR<\/small> (1 to get timestamps, 2 to get a summary report at the <small>END<\/small> of the program, 3 to get mini reports after each run) or to a filename to emit raw data to a file for later analysis.<\/p>\n<h2>COMPARISON <a name=\"COMPARISON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Here\u2019s how it stacks up to existing APIs:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>compared to &#8220;system()&#8221;, &#8220;qx&#8221;&#8221;, &#8220;open &#8220;&#8230;|&#8221;&#8221;, &#8220;open &#8220;|&#8230;&#8221;&#8221;<\/b><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">better: redirects more than one file descriptor<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: returns <small>TRUE<\/small> on success, <small>FALSE<\/small> on failure<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: throws an error if problems occur in the parent process (or the pre-exec child)<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: allows a very perlish interface to Perl data structures and subroutines<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: allows 1 word invocations to avoid the shell easily:<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">run3 [&#8220;foo&#8221;]; # does not invoke shell<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"81%\">\n<p style=\"margin-top: 1em\">worse: does not return the exit code, leaves it in $?<\/p>\n<\/td>\n<td width=\"2%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>compared to &#8220;open2()&#8221;, &#8220;open3()&#8221;<\/b><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">better: no lengthy, error prone polling\/select loop needed<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: hides <small>OS<\/small> dependencies<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: allows <small>SCALAR, ARRAY,<\/small> and <small>CODE<\/small> references to source and sink I\/O<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: I\/O parameter order is like &#8220;open3()&#8221; (not like &#8220;open2()&#8221;).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>worse: does not allow interaction with the subprocess<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>compared to IPC::Run::run()<\/b><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">better: smaller, lower overhead, simpler, more portable<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: no <b>select()<\/b> loop portability issues<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>better: does not fall prey to Perl closure leaks<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>worse: does not allow interaction with the subprocess (which <b>IPC::Run::run()<\/b> allows by redirecting subroutines)<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>worse: lacks many features of &#8220;IPC::Run::run()&#8221; (filters, pipes, redirects, pty support)<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved<\/p>\n<h2>LICENSE <a name=\"LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">You may use this module under the terms of the <small>BSD,<\/small> Artistic, or <small>GPL<\/small> licenses, any version.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Barrie Slaymaker <\"barries@slaysys.com\"><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Ricardo <small>SIGNES<\/small> <\"rjbs@cpan.org\"> performed routine maintenance since 2010, thanks to help from the following ticket and\/or patch submitters: Jody Belka, Roderich Schupp, David Morel, Jeff Lavallee, and anonymous others.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  IPC::Run3 \u2212 run a subprocess with input\/ouput redirection <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3520,3007],"class_list":["post-7188","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-ipcrun3","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7188"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7188\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}