![]() |
|
![]() | ||
|
Subject:
Shell-escaping from perl
Category: Computers > Programming Asked by: lexi-ga List Price: $3.00 |
Posted:
29 Jan 2003 17:05 PST
Expires: 28 Feb 2003 17:05 PST Question ID: 155019 |
Suppose I want to invoke a shell command from perl and provide some user-supplied data as input to the shell command. The user-supplied input has to be escaped so the shell will not interpret any part of it. I already know how to write a regular expression to do this - this regular expression is littered throughout my code in far too many places. What I want to know is if there is a function in a standard perl module somewhere that will do this. Every time I copy and paste my homegrown regular expression, I worry I'm missing part of it, and it's not terribly readable. (I do not want to take my regular expression and make my own function out of it - this does not solve the problem for when I start a batch of new code because I'd have to cart that function around with me.) | |
| |
|
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: Shell-escaping from perl
From: sycophant-ga on 29 Jan 2003 23:07 PST |
Drat. I could have sworn there was something like that in CGI.pm, but I can't find anything about it on the web, or in my big old O'Reilly Perl Resource Kit (normally used as a bookend). There are heaps of 'recipes' for that however, and you could always roll your own module, it is often nice to have your own toolkit of little things to take from one project to another. :) Oh well, I am sure someone will find what you are looking for. Regards, sycophant-ga |
Subject:
Re: Shell-escaping from perl
From: yatha-ga on 14 Feb 2003 08:04 PST |
Try \Q your params \E. If this does not work , I will tell you a more complex way to do that. This is the most natural way I can think of. E.g system ("zip -q zip_name.zip \Qfilename\E"); |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |