perlmeditation
gmpassos
Hello monks,
<p>
Recently I have posted a prototype of Perl embeded into Java ([id://372197]), as a simplier alternative for [JPL] (not any more in development). <i>One advantage over [JPL] is that it works on Win32</i>.
<p>
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 [cpan://PLJava] with Java RMI, since for each RMI application you have a Thread that is not the main.
<p>
Also I have wrapped the basics of the module [cpan://XML::Smart] to Java as class XMLSMart.
<p>
Note that [cpan://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.
<p>
The 1st release is at:<br>
[http://www.cpan.org/authors/id/G/GM/GMPASSOS/PLJava-0.01.tar.gz]<br>
[http://www.cpan.org/authors/id/G/GM/GMPASSOS/PLJava-0.01.readme]
<p>
I have tested it on Win32, and need some test over Linux yet, but it should work, at least with small changes.
<p>
I will appreciate any type of feedback. Thanks in advance. ;-P
<p>
<b>USAGE</b>
<code>
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
}
}
</code>
<p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-184322">
<p>
Graciliano M. P.<br>
"Creativity is the expression of the liberty".
</div></div>