=> NAME PLJava - This project will embed Perl into Java. => 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 } } => PREREQUISITES *> JAVA SDK 1.4+ Home & Download: http://java.sun.com/ *> Perl 5.6+ Home: http://www.perl.com/ Download from: http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl http://www.activestate.com/Solutions/Programmer/Perl.plex => BUILD/INSTALL First install the Java and Perl binaries. Don't forget to set the enverioment variables for Java. Examples: JAVA_BIN=C:\j2sdk1.4.0\bin JAVA_HOME=C:\j2sdk1.4.0 JAVA_INCLUDE=C:\j2sdk1.4.0\include You also will need to have the Java and Perl binaries in the search PATH: PATH=C:\j2sdk1.4.0\bin;C:\Perl\bin\;%PATH% After have the binaries well installed just type: Perl MakeFile.PL nmake Now you are able to run the test.java example: nmake test ## or: java test I directory with all the files needed to be with your Java application. In this directory you also will have the test.java example to test it in this directory.> Enjoy! => Java package: perl5 All the compiled Java classed will be inside the I package/directory. To use PLJava from your Java application you will need this files in the main diretory of your application: PLJava.dll ## The PLJava library that loads the Perl interpreter. PLJava.pm ## Perl side of PLJava. Perl56.dll ## The Perl library in case that you have Perl built dynamic. perl5/* ## Diretory with PLJava classes. lib/* ## A Perl lib directory with basic .pm files (strict, warnings, etc...) I => SWIG The source files generated by SWIG (I) come already built for your convenience. If you want to install SWIG to generate this files again just type: nmake swig Home: http://www.swig.org/ Download from: http://prdownloads.sourceforge.net/swig/swigwin-1.3.21.zip I<** Don't forget to add SWIG in the search PATH:> PATH=C:\SWIG-1.3.21;%PATH% => Win32 You will need to have VC++ 6+ to compile PLJava, since your Perl version for Win32 (from ActiveState) will be probably compiled with VC++, and we need the same compiler of the interpreter to embed a Perl program. => Linux I haven't tested it on Linux yet, but should work! => Threads The support to call Perl from Java from multiple Java Threads was added and tested on Win32, where Threads are native. Note that if you are compiling PLJava with Perl 5.8+ you can use Perl Threads too. => AUTHOR Graciliano M. P. I will appreciate any type of feedback (include your opinions and/or suggestions). ;-P => COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.