Call other programs and need return value


#1

hi, all,
You know if you use system call to call a perl script in Ruby’s
controller, it will only return the status for the status of
execution but not the return value of perl script.
I really need the return value of the perl script, can I get it and
how can I get it?


#2

One possibility would be for your Perl script to write it to a file,
then have your Ruby controller read the file. I’d like to know if
there are other ways, though…


#3

mikebind wrote:

One possibility would be for your Perl script to write it to a file,
then have your Ruby controller read the file. I’d like to know if
there are other ways, though…

Well I do know this. Just as in bash scripting using the backquote
(tick) around command runs in a subshell and returns the standard output
from the command.

Example:

irb(main):001:0> date
=> “Thu Dec 18 14:00:09 EST 2008\n”
irb(main):002:0>

So as long as your Perl script outputs the result to standard out this
should work.