Alien-ROOT
view release on metacpan or search on metacpan
inc/inc_IPC-Cmd/IPC/Cmd.pm view on Meta::CPAN
If your command contains B<special characters> (< > | &), it will
be internally stringified before executing the command, to avoid that these
special characters are escaped and passed as arguments instead of retaining
their special meaning.
However, if the command contained arguments that contained whitespace,
stringifying the command would loose the significance of the whitespace.
Therefore, C<IPC::Cmd> will quote any arguments containing whitespace in your
command if the command is passed as an arrayref and contains special characters.
=item Whitespace and IPC::Run
When using C<IPC::Run>, if you provide a string as the C<command> argument,
the string will be split on whitespace to determine the individual elements
of your command. Although this will usually just Do What You Mean, it may
break if you have files or commands with whitespace in them.
If you do not wish this to happen, you should provide an array
reference, where all parts of your command are already separated out.
Note however, if there are extra or spurious whitespaces in these parts,
the parser or underlying code may not interpret it correctly, and
cause an error.
Example:
The following code
gzip -cdf foo.tar.gz | tar -xf -
should either be passed as
"gzip -cdf foo.tar.gz | tar -xf -"
or as
['gzip', '-cdf', 'foo.tar.gz', '|', 'tar', '-xf', '-']
But take care not to pass it as, for example
['gzip -cdf foo.tar.gz', '|', 'tar -xf -']
Since this will lead to issues as described above.
=item IO Redirect
Currently it is too complicated to parse your command for IO
redirections. For capturing STDOUT or STDERR there is a work around
however, since you can just inspect your buffers for the contents.
=item Interleaving STDOUT/STDERR
Neither IPC::Run nor IPC::Open3 can interleave STDOUT and STDERR. For short
bursts of output from a program, e.g. this sample,
for ( 1..4 ) {
$_ % 2 ? print STDOUT $_ : print STDERR $_;
}
IPC::[Run|Open3] will first read all of STDOUT, then all of STDERR, meaning
the output looks like '13' on STDOUT and '24' on STDERR, instead of
1
2
3
4
This has been recorded in L<rt.cpan.org> as bug #37532: Unable to interleave
STDOUT and STDERR.
=back
=head1 See Also
L<IPC::Run>, L<IPC::Open3>
=head1 ACKNOWLEDGEMENTS
Thanks to James Mastros and Martijn van der Streek for their
help in getting L<IPC::Open3> to behave nicely.
Thanks to Petya Kohts for the C<run_forked> code.
=head1 BUG REPORTS
Please report bugs or other issues to E<lt>bug-ipc-cmd@rt.cpan.orgE<gt>.
=head1 AUTHOR
Original author: Jos Boumans E<lt>kane@cpan.orgE<gt>.
Current maintainer: Chris Williams E<lt>bingos@cpan.orgE<gt>.
=head1 COPYRIGHT
This library is free software; you may redistribute and/or modify it
under the same terms as Perl itself.
=cut
( run in 0.484 second using v1.01-cache-2.11-cpan-97f6503c9c8 )