# from Chris Dawson
# on Monday 17 July 2006 05:09 pm:
>"perl -e 'while( <> ) { push @stuff, $_; }; print @stuff'"
I hope everything in that string is trusted and/or well-escaped. It
looks like popen doesn't have a way to take an array ala exec/system,
so you're stuck worrying about "';rm -rf" and other fun stuff (
like fi|lenames with fun(ny) characters).
puts IO.popen("echo foo | sed s/o/e/g").read
Is there a well-done open3 or other library for ruby? In perl, I always
use IPC::Run for any non-trivial system/pipe/subprocess stuff.
And I really have to ask why you need to fork a perl one-liner in your
ruby :-) If ruby's C API is so sweet and it has threads, just embed a
perl interpreter in a thread.
--Eric
--
I eat your socks and you pay me.
--The business sense of a very small goat.
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby