jeffm712 has asked for the wisdom of the Perl Monks concerning the following question:
The jist is I want to execute a system command without worrying about shell metacharacters or quoting, and I'd also like to capture both STDOUT and STDERR.
system PROGRAM LIST is an obvious place to start. This seems to avoid the shell like I wanted, but I can't capture the output. To do that, the docs suggest I use backticks. Backticks let me get the output, but now I have to worry about shell metacharacters again. Using open also seems to rely on the shell.
So... is there a shell escape function I can use? Or is there a module to safely handle spawning and communicating with processes? Or some other standard practice? What's the way to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Safe Execute System Command and Capture Output
by Anonymous Monk on Aug 28, 2014 at 23:08 UTC |