Embeding Perl into Java to use CPAN modules directly from Javaby gmpassos (Priest)
|on Jul 06, 2004 at 20:15 UTC
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
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.