Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

call a perl function from ruby

1 view
Skip to first unread message

say...@yahoo.com

unread,
Apr 7, 2006, 9:46:09 AM4/7/06
to
HI,

I have a lot of script written with perl, and we want to call those
script with our new ruby application. and we don't know how!!! Can
anyone tell us how should we do this????

Thanks you vbery much

Sayoyo

ChrisH

unread,
Apr 7, 2006, 11:01:04 AM4/7/06
to

You can run a system command via:
`perl myPerlScript.pl`

or check the system method

say...@yahoo.com

unread,
Apr 7, 2006, 11:19:46 AM4/7/06
to
Hi,

Thanks for the information, but how can I get the results from our perl
script.???

actually, we find out that we can use this code:

obj = IO.popen("/usr/bin/perl hello_world.pl world", "w+")
obj.close_write
toto = obj.gets
obj.close
puts toto

but is there other way to do this?

sayoyo

ChrisH

unread,
Apr 7, 2006, 12:01:13 PM4/7/06
to

Well:

foo = `type readme.txt`

will put the contents of readme.txt into foo, so is good for grabbing
stdout from the external app

Or you can check out popen3 if you need separate acces to STDIN, STDOUT
and STDERR

0 new messages