Use Perl modules from Ruby?

Hi Ruby-Community :slight_smile:

I was looking for a way to talk to a Perl module from Ruby directly to
use its classes, methods or functions. However, it seems there is no
up2date/maintained Ruby/Perl binding ? I have found the “Perl module for
Ruby” (http://www.yoshidam.net/perl_en.txt), but his website states it
is no longer maintained and also it seems not like an offical thing
available in Rubyforge.

I am aware of %x{ … } to run scripts and stuff, but what I really want
is to use some legacy Perl modules which are too big to convert
completely into Ruby.

Any ideas, suggestions and tips ? My search so far was pretty boring.
Seems like not many people would like to do this ?

Thank you and best regards!

PS: Sorry if I am just stupid and not aware of a obvious thing available
in Ruby. I am new to the language and might not have seen “THE WAY” to
go :wink:

+1 interested in the solution too

On 9/29/06, Dr Nic [email protected] wrote:

+1 interested in the solution too

Would something like this be possible with RubyInline?

You’d probably need to hack up a Perl handler for it.

Martin

Markus B. wrote:

is to use some legacy Perl modules which are too big to convert

Hmmm … is enough of Cardinal (Ruby interface to Parrot), Parrot and
the Perl interface to Parrot working that this could be done that way?
That was one of the goals of Parrot – a virtual machine that would
support at least Perl, Python and Ruby and maybe other dynamic
languages.

On 9/29/06, Markus B. [email protected] wrote:

I am aware of %x{ … } to run scripts and stuff, but what I really want
is to use some legacy Perl modules which are too big to convert
completely into Ruby.

I have a hard time imagining a Perl module too big to convert
completely into Ruby. What does the module do? Is it proprietary, or
is it on CPAN somewhere?

-A

On Sep 29, 2006, at 9:08 AM, Alex LeDonne wrote:

On 9/29/06, Markus B. [email protected] wrote:

I am aware of %x{ … } to run scripts and stuff, but what I
really want
is to use some legacy Perl modules which are too big to convert
completely into Ruby.

I have a hard time imagining a Perl module too big to convert
completely into Ruby. What does the module do? Is it proprietary, or
is it on CPAN somewhere?

If it’s an OO Perl module, odds are good the Ruby will be smaller.

James Edward G. II

On 9/29/06, Alex LeDonne [email protected] wrote:

On 9/29/06, Markus B. [email protected] wrote:

I am aware of %x{ … } to run scripts and stuff, but what I really want
is to use some legacy Perl modules which are too big to convert
completely into Ruby.

I have a hard time imagining a Perl module too big to convert
completely into Ruby. What does the module do? Is it proprietary, or
is it on CPAN somewhere?

Yes, what is it? Maybe someone would want to convert it.

On 9/29/06, Leslie V. [email protected] wrote:

Yes, what is it? Maybe someone would want to convert it.

It might be useful to have some sort of Ruby “porting party” website.
A central location where folks interested in a given library can all
get together and set up a date/time where they could get together
online and churn it out. Maybe have a “top 10 most-wanted libs” list,
sign-up sheet, wish-list, calendar, “Done” list…

—John

If it’s an OO Perl module, odds are good the Ruby will be smaller.

James Edward G. II

In my situation, we have a generated perl library and a perl wrapper for
a compiled library.

  1. Yes I can generate a Ruby library
  2. Yes I can probably write my own Ruby wrapper for the compiled library

I am hoping the elusive ruby -> perl hooks mean I don’t have to.

#2 scares me.

Nic

On 9/29/06, John G. [email protected] wrote:

It might be useful to have some sort of Ruby “porting party” website.
A central location where folks interested in a given library can all
get together and set up a date/time where they could get together
online and churn it out. Maybe have a “top 10 most-wanted libs” list,
sign-up sheet, wish-list, calendar, “Done” list…

top 1 most-wanted libs:

  • LWP

It would be a severe understatement to say LWP is the best
www library in any language ever made. Nothing I’ve ever seen
gets even close. And it’s pretty unlikely Ruby can get a
comparable library any time soon in any way other than
recoding the real thing.

Anther really cool perl lib is IO::Multiplex.

snacktime wrote:

I have a hard time imagining a Perl module too big to convert
completely into Ruby. What does the module do? Is it proprietary, or
is it on CPAN somewhere?

Date::Manip

Is there something Date::Manip can do that the built-in date calculators
in Rails can’t do?

I have a hard time imagining a Perl module too big to convert
completely into Ruby. What does the module do? Is it proprietary, or
is it on CPAN somewhere?

Date::Manip

Thanks so far for all your answers.

Dr Nic wrote:

  1. Yes I can probably write my own Ruby wrapper for the compiled library

I am hoping the elusive ruby -> perl hooks mean I don’t have to.

Yes, Dr Nic - this was exactly what I was thinking of. A generic ruby ->
perl wrapper, but this is maybe illusive :wink:

Therefore I guess I have to write my own little wrapper.
BTW: The code is proprietary.

Any further ideas of an GERNERIC Ruby->Perl interface/wrapper ?
Thanks for any reply.

-----BEGIN PGP SIGNED MESSAGE-----

In article [email protected],
Dr Nic [email protected] wrote:

I am hoping the elusive ruby → perl hooks mean I don’t have to.

#2 scares me.

_ If you’ve done #2 for perl, doing it for ruby is about a
zillion times easier… The internal ruby interface is very
clean and simple to work with at least in comparision to XS.

_ Booker C. Bense

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBRS0u0WTWTAjn5N/lAQH2PQQAg7MdQ5Qhhd9CNIDZBrSKII1b7vB00y88
WDiXJa65pnkDX+VBa7u9Tv8UTeP3iqBu5j16OSmNFAu8McyLvOkh7VKQyHJHyqM1
04z4PH/DClAkmA9+kGcpQ9y06Dx/aTqsOWFXYt+Qmsb3r/7SFtE6Y7pj772MiXAz
ASLkiH3Imtc=
=8+fs
-----END PGP SIGNATURE-----

Booker C.Bense wrote:

Dr Nic [email protected] wrote:

I am hoping the elusive ruby → perl hooks mean I don’t have to.

#2 scares me.

_ If you’ve done #2 for perl, doing it for ruby is about a
zillion times easier… The internal ruby interface is very
clean and simple to work with at least in comparision to XS.

_ Booker C. Bense

I was lucky - someone else did it in Perl. But they won’t do it for Ruby
:slight_smile:

Wrapping C is on my list of things to do. I don’t want to be scared any
more. I want to be freeeee.

Nic

On Sep 29, 2006, at 6:04 AM, Martin C. wrote:

On 9/29/06, Dr Nic [email protected] wrote:

+1 interested in the solution too

Would something like this be possible with RubyInline?

You’d probably need to hack up a Perl handler for it.

There is one. I’ll try to pry it out of Ryan D.’ fingers.

–
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Dr Nic wrote:

_ Booker C. Bense

I was lucky - someone else did it in Perl. But they won’t do it for Ruby
:slight_smile:

Wrapping C is on my list of things to do. I don’t want to be scared any
more. I want to be freeeee.

Nic

As near as I can tell after a couple of weeks of experimentation,
wrapping C is a piece of cake with SWIG, and you get interfaces for
Ruby, Python, Perl, PHP, tcl, clisp, lua, pike and a couple of variants
of Scheme with little additional effort. Wrapping C++ with SWIG, on the
other hand, does require a bit more detailed reasoning. But the
documentation on the Ruby/C++ interface is very good, and if the C++ is
well-written, it’s at least doable.