I need to write a ruby program that can spawn and then communicate
with a perl program. Basically I need to send some data via stdin,
then process that data. This works from the command line:
perl -e 'while( <> ) { push @stuff, $_; }; print @stuff'
It reads in stdin, and when finished, prints it all out. Great.
Now, I want to run this from within ruby. I assumed I could do this:
def test( items )
IO.popen "perl -e 'while( <> ) { push @stuff, $_; }; print @stuff'" do |p|
items.keys.each do |i|
p.puts( i + "=>" + items[i] )
end
end
end
But, this just hangs. Any suggestions, or an explanation why the
above doesn't work?
Chris
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby