Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Embeding Perl into Java to use CPAN modules directly from Java

by gmpassos (Priest)
on Jul 06, 2004 at 20:15 UTC ( [id://372197] : perlmeditation . print w/replies, xml ) Need Help??

Hello monks!

Recently I have posted a node about JPL (JPL - Embeding Perl into Java for Win32), the main project that integrates Perl and Java, where we are able to call Perl from Java and Java from Perl. But the project is stoped since 2001!!! Actually the project have stoped in a begin stage, and is still a experiment. I have tried to use it on Windows but doesn't work, and for Linux it crashes.

The main idea of JPL is very interesting, since we are able to create a .jpl file that have both Java and Perl methods. We also are able to call directly from Perl Java classes, but for me this is not the point, since we have Inline::Java.

I think that the project have stoped since in the future it won't be necessary, since Parrot will integrate a lot of languages, including Java and Perl. But today I need to use Perl modules from Java, since I have a lot of work done in Perl.

Well, why not create my own Perl and Java enverioment?! Or at least try. I already have worked with Perl embeded into C programs, specially for TinyPerl, so, I have embeded Perl int a .c file, than I linked this C file/functions with the Java VM, and bingo, I was able to evaluate Perl code directly from Java without use any IPC! ;-P

Perl.eval("print 'Hello World!' ;") ;
Than I worked in a way to use Perl objects directly from Java, and now I can use my Perl modules from Java. For now I have XML::Smart working from Java, and everything is fine.

Now I'm thinking to create a intuitive way to use Perl modules from Java, since the interface that I have now is similar to use Perl from C. I don't know if I keep the development of JPL or start my own JPL getting some codes from the old project. The problem of JPL is that it's architecture is very complex, and what I have now wasn't made to be installed into a real Perl distribution, but directly in Java. So, what I should do?

What I have done until now is in this link, and was tested for Win32:

Graciliano M. P.
"Creativity is the expression of the liberty".

Replies are listed 'Best First'.
Re: Embeding Perl into Java to use CPAN modules directly from Java
by perrin (Chancellor) on Jul 06, 2004 at 20:26 UTC
    I think JPL was abandoned because there was so little interest in it. Since both languages can do just about anything and since a single-language solution is always going to be more efficient, there's just not a big need for it. It sounds like a cool hack though.
Re: Embeding Perl into Java to use CPAN modules directly from Java
by revdiablo (Prior) on Jul 06, 2004 at 20:37 UTC
    So, what I should do?

    It seems there isn't a huge amount of demand for this kind of thing, and perrin's post reinforces that. I don't think it's such a bad idea, though. It would be a shame for the work you've done so far to go to waste. I would suggest you do only what you need to do in order to get it working for yourself. Release what you have done, so others can work with it if they want, but there's no point in doing work without a target audience.

Re: Embeding Perl into Java to use CPAN modules directly from Java
by fletcher_the_dog (Friar) on Jul 07, 2004 at 15:25 UTC
    I am excited to check this out. I would be very interested in it if it works. My company has some software that used to allow perl plugins, but our latest and "greatest" version now only allows java plugins, which some of our customers are not too happy about because they will have to port all there perl plugins to java, if this works it could be great resource saver for them.
Re: Embeding Perl into Java to use CPAN modules directly from Java
by didier (Vicar) on Jul 07, 2004 at 09:35 UTC

    Tested :)
    This is a wonderful game, done with brio
    I am really interested to see how you will make this toy more powerful.