http://qs321.pair.com?node_id=373839

Hello monks,

Recently I have posted a prototype of Perl embeded into Java (Embeding Perl into Java to use CPAN modules directly from Java), as a simplier alternative for JPL (not any more in development). One advantage over JPL is that it works on Win32.

Now I have finished the basic wrappers to work with Perl from Java, specially to control and use Perl objecs directly from Java. Also I have added support for multiple Java Native Threads calling the same Perl interpreter, so, is possible to use PLJava with Java RMI, since for each RMI application you have a Thread that is not the main.

Also I have wrapped the basics of the module XML::Smart to Java as class XMLSMart.

Note that PLJava was made to be installed in Java, or to be with your Java applications, and not to be installed on Perl. So, you can publish your Java application using Perl without need to ask for the user to install Perl to run it.

The 1st release is at:
http://www.cpan.org/authors/id/G/GM/GMPASSOS/PLJava-0.01.tar.gz
http://www.cpan.org/authors/id/G/GM/GMPASSOS/PLJava-0.01.readme

I have tested it on Win32, and need some test over Linux yet, but it should work, at least with small changes.

I will appreciate any type of feedback. Thanks in advance. ;-P

USAGE

import perl5.Perl ; import perl5.SV ; public class test { public static void main(String argv[]) { Perl.eval("print qq`Hello World!\n` ;") ; /////////////////// SV foo = Perl.NEW("foo") ; // $foo = new foo() ; foo.call("subtest") ; // $foo->subtest() ; /////////////////// String s = Perl.eval(" 'time: ' + time() ") ; int i = Perl.eval_int(" 2**10 ") ; // 1024 int n = Perl.eval_int(" 10/3 ") ; // 3 int d = Perl.eval_double(" 10/3 ") ; // 3.33333333333333 /////////////////// SV array = Perl.eval_sv(" [ 'a' , 'b' , 'c' ] ") ; String e0 = array.elem(0) ; // a String e1 = array.elem(1) ; // b String e2 = array.elem(2) ; // c /////////////////// SV hash = Perl.eval_sv(" { a => 11 , b => 22 , c => 33 } ") ; String k_a = hash.key("a") ; // 11 String k_b = hash.key("b") ; // 22 String k_c = hash.key("c") ; // 33 } }

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