Re: [Networker] How can I do this in perl?
2004-11-12 13:08:25
In regard to: Re: [Networker] How can I do this in perl?, George Sinclair...:
In the past, to get around this problem, I have used
system command with the necessary arguments in a list to avoid calling
the shell.
That's very very good advice, and a trick too few perl programmers know.
I presume the user knows what he's doing. In one case, I must
be able to capture the output that the system command would normally
return which is not possible. To avoid using backticks (insecure) or
other screwing around, I would have in the past used exec with a pipe to
allow the parent to read the results from the child.
Also a good trick (the implicit fork()/exec() with open()). IPC::Open2
and IPC::Open3 (both included with perl) are also useful in this
situation. The "Safe Pipe Opens" section of perlipc docs has good
information about this subject.
Tim
--
Tim Mooney mooney AT dogbert.cc.ndsu.NoDak DOT edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list. Questions regarding this list
should be sent to stan AT temple DOT edu
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
|
|