From: Corey Jewett Date: 2007-07-15T13:23:13+09:00 Subject: Re: Calling a Perl script from Ruby On Jul 14, 2007, at 9:12 PM, James Edward Gray II wrote: > On Jul 14, 2007, at 9:44 PM, M. Edward (Ed) Borasky wrote: > >> Dave Coleman wrote: >>> Tim Hunter wrote: >>>> Check out the system() method. >>> looks like system only returns true or false if the system call >>> executes >>> successfully. What if you want to evaluate what's returned from that >>> perl script? >>> >> IIRC "system" returns the (implementation-dependent) numerical return >> code of the call, where by tradition "0" is success and non-zero >> is an >> application-dependent error number. If Ruby is returning "true" on >> success and "false" on failure, that's different from what many >> environments do. > > It does, but you can get the exit code: > > system("date") # => true > $?.to_i # => 0 > # >> Sat Jul 14 23:11:49 CDT 2007 There is also Kernel.`` which will return stdout. If you're looking for something more powerful still look at popen, Open3, or (best of all ;D) the Open4 gem. Corey