|Perl: the Markov chain saw|
system, pipes, shell, quotingby superpete (Beadle)
|on Nov 13, 2002 at 03:32 UTC||Need Help??|
superpete has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks. Here is my situation. Currnet Code:
I need to handle the possibility that the variables contain arbitrary weird characters (ANYTHING except / and nul).
The problem is that the shell is invoked, which messes things up. A previous posting here suggested that I use quotemeta (\Q, \E) , which appeared to work at first. Since then, however, I have done more rigorous testing, and for really weird filenames it fails.
Is there a standard way to deal with this, while keeping the convenience of the above line of code?
Is the right thing to cook up a function which takes a list of command lines, makes a bunch of pipes, and then forks off and exec's each "piece" of the pipeline (thereby avoiding the shell) ?? This seems like it would work but would be difficult to do in a "bulletproof" manner. Is there a standard module for this?
What should I do?