Professional Web Applications Themes

Ruby and Perl Integration - Ruby

All this talk about RJNI has gotten me thinking. Has anyone attempted to integrate Perl with Ruby? Since one of perl's greatest strengths is a huge code library it would incredible to leverage those same libraries for Ruby. ___________________ John Long www.wiseheartdesign.com...

  1. #1

    Default Ruby and Perl Integration

    All this talk about RJNI has gotten me thinking. Has anyone attempted to
    integrate Perl with Ruby? Since one of perl's greatest strengths is a huge
    code library it would incredible to leverage those same libraries for Ruby.
    ___________________
    John Long
    www.wiseheartdesign.com




    John Guest

  2. #2

    Default Re: Ruby and Perl Integration

    ----Thomas Adam wrote:---- 

    I would think their similarities would make it easier to integrate them. I'm
    thinking of a perl.so extension. Something that would let me do:

    require "perl"
    perl_require "myperlmodule"

    and then use the perl code in a rubyish way. How would you see having the
    leverage of perl libraries behind ruby as a pointless thing?

    --
    John




    John Guest

  3. #3

    Default Re: Ruby and Perl Integration

    John W. Long wrote:
     

    There's already a similar thing for Python that works quite seamlessly, doing automatic conversion between Ruby/Python data types etc.

    Has anyone actually used it for real work? I don't remember ever seeing anyone mention it on the list.

    Harry O.



    Harry Guest

  4. #4

    Default Re: Ruby and Perl Integration

    Hello John,

    Friday, January 30, 2004, 3:07:23 AM, you wrote:


    JWL> and then use the perl code in a rubyish way.

    And this is a logical mistake. Even if Perl is near Ruby in a few ways
    (i think this is not so much). A rubyish way can never be generated automatically
    from Perl. The only way is to automatically generate function wrappers.


    --
    Best regards,
    Lothar mailto:com



    Lothar Guest

  5. #5

    Default Re: Ruby and Perl Integration

    ----Lothar Scholz wrote:---- 
    automatically 

    My ignorance shows here. I'm not a perl coder. I don't know how easy it
    would be to integrate the two. But even if there was just a simple:

    Perl::eval %{
    use MyModule;
    ...
    my $m = MyModule->new;
    $m->func;
    }

    Where eval would return some sort of object wraping the result of func it
    seems like you could write small ruby libraries that would leverage the
    support of much larger perl libraries. Even if it were ugly, ugliness can be
    hidden withing small Ruby classes.

    I've seen several Ruby projects that are merely ports of Perl Libraries. It
    seems like this process might be made easier if you could write a Ruby
    wrapper for an existing Perl library and then gradually rewrite the code in
    Ruby as you have the time. Perl integration with Ruby would also make it
    easier for people to port their existing Perl applications to Ruby.

    --
    John




    John Guest

  6. #6

    Default Re: Ruby and Perl Integration

    In article <com>,
    Harry Ohlsen <com> wrote: 
    >
    >There's already a similar thing for Python that works quite seamlessly,
    >doing automatic conversion between Ruby/Python data types etc.
    >
    >Has anyone actually used it for real work? I don't remember ever seeing
    >anyone mention it on the list.
    >[/ref]

    What's it called? If it's doable between Perl & Python it should be
    doable between Perl & Ruby.

    Phil
    Phil Guest

  7. #7

    Default Re: Ruby and Perl Integration

    In article <010c01c3e6e4$dac1c5d0$6601a8c0jwldesktop>,
    John W. Long <com> wrote: 
    >automatically 
    >
    >My ignorance shows here. I'm not a perl coder. I don't know how easy it
    >would be to integrate the two. But even if there was just a simple:
    >
    >Perl::eval %{
    > use MyModule;
    > ...
    > my $m = MyModule->new;
    > $m->func;
    >}
    >
    >Where eval would return some sort of object wraping the result of func it
    >seems like you could write small ruby libraries that would leverage the
    >support of much larger perl libraries. Even if it were ugly, ugliness can be
    >hidden withing small Ruby classes.
    >
    >I've seen several Ruby projects that are merely ports of Perl Libraries. It
    >seems like this process might be made easier if you could write a Ruby
    >wrapper for an existing Perl library and then gradually rewrite the code in
    >Ruby as you have the time. Perl integration with Ruby would also make it
    >easier for people to port their existing Perl applications to Ruby.[/ref]

    Perhaps, but I suspect that if it worked well enough that no one would
    find the time to rewrite the code in Ruby. It could actually be
    counterproductive. People would just figure that well we can just grab
    the Perl module Foo::Bar and use it with the Perl_eval thingy and nobody
    would bother to actually translate Foo::Bar to Ruby and 'rubyfy' it.

    ....Not saying that you shouldn't try to make a bridge between the two
    languages just saying that this could be a consequence.

    Phil
    Phil Guest

  8. #8

    Default Re: Ruby and Perl Integration

    Phil Tomson wrote:
     

    The URL is

    http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python-e.html

    You can do stuff like ...

    require 'python'
    require 'python/ftplib'

    ftp = Py::Ftplib::FTP.new('ftp.netlab.co.jp')
    ftp.login
    ftp.cwd('pub/lang/ruby')
    ftp.dir
    ftp.quit

    Very neat, indeed.

    Cheers,

    Harry O.




    Harry Guest

  9. #9

    Default Re: Ruby and Perl Integration

    By the way, on that page there's a broken link to something called perllib. I did a quick Google and found the following page:

    http://rpmfind.net/linux/RPM/contrib/libc6/i386/ruby-perl-0.2.9-1.i386.html

    It says "This is a module to call Perl functions from Ruby programs."

    Since it's not in RAA, it may be that it's not very functional at this stage, but it's certainly intriguing!

    I note the build date is April 2002, so maybe it's a dead project, but who knows ...

    Harry O.





    Harry Guest

  10. #10

    Default Ruby perllib

    I found the main web page for perllib here ...

    http://www.yoshidam.net/Ruby.html#perl

    Looks like it was built back in the Ruby 1.6.4 days, so there may be some work involved in getting it running under 1.8.1 ... left as an exercise for the reader :-).

    Harry O.



    Harry Guest

  11. #11

    Default Re: Ruby and Perl Integration

    il Fri, 30 Jan 2004 11:26:06 +0900, Harry Ohlsen
    <com> ha scritto::
     
    >
    >There's already a similar thing for Python that works quite seamlessly, doing automatic conversion between Ruby/Python data types etc.
    >
    >Has anyone actually used it for real work? I don't remember ever seeing anyone mention it on the list.
    >[/ref]

    I suppose that lib was designed as of python 1.5 . Python changed in
    the meanwhile..
    gabriele Guest

  12. #12

    Default Re: Ruby perllib

    il Fri, 30 Jan 2004 14:39:44 +0900, Harry Ohlsen
    <com> ha scritto::
     

    you can even look for perlinside that was mentioned looong time ago in
    this list.. But not before 1.6.7 :)
    gabriele Guest

  13. #13

    Default Re: Ruby and Perl Integration

    Well, it would be one more option, wouldn't it? Right now you have two
    choices: 1. Rewrite the functionality in a new Ruby library, or 2. Use
    Perl. This would introduce a new in-between option. Nobody should be
    forced to port code simply as a matter of principle.

    I should say also, that one of the things that Ruby gives you as the
    power to re-imagine how your library interface should look. If you're
    going to design something that externally looks exactly like a Perl
    library, then maybe there's not much point in re-writing it anyway.

    Francis

    com (Phil Tomson) wrote in message news:<newsguy.com>...
     
    Francis Guest

  14. #14

    Default Re: Ruby and Perl Integration

    net (Francis Hwang) wrote in message news:<google.com>... 

    Yes, it would be an option and it might introduce more Perl
    programmers to Ruby. I was just pointing out that there could end up
    being unintended consequences if a bridge like that ended up working
    really well.
     

    Not much disagreement here either. Except the part about "then maybe
    there's not much point in re-writing it anyway". Some people wouldn't
    want to rely on a cross-language solution... so if they've decided to
    go with Ruby and they end up doing a port of a particular Perl library
    they need and it ends up looking pretty-much like it would in Perl,
    well, at least that's a starting point. It can always be 'Rubyfied'
    later.

    Phil
     [/ref]
    Phil Guest

Similar Threads

  1. Project: in Ruby, Perl?
    By Zach in forum Ruby
    Replies: 9
    Last Post: January 29th, 04:27 PM
  2. Perl equivalent of Ruby/DL?
    By David Garamond in forum PERL Beginners
    Replies: 3
    Last Post: January 7th, 03:17 PM
  3. Ruby & Perl
    By David Corbin in forum Ruby
    Replies: 14
    Last Post: August 25th, 11:00 AM
  4. Replies: 3
    Last Post: June 27th, 03:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139