Click here to get back home

PLJava - Perl embeded into Java (calling Perl from Java) - 1sr release - call for tests and review, please.

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
PLJava - Perl embeded into Java (calling Perl from Java) - 1sr release - call for tests and review, please. Graciliano M. P. 07-13-2004
Posted by Graciliano M. P. on July 13, 2004, 4:06 am
Please log in for more thread options
Recently on perlmonks.com I have posted a prototype of Perl embeded into
Java (#372197="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 PLJava 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 into 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

Regards,
Graciliano M. 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

}

}


Similar ThreadsPosted
LWP and java servlet error (newbie) October 29, 2005, 6:03 pm
The Month in Perl Software Design: Review of January 2005 February 10, 2005, 10:39 pm
ANNOUNCE: Initial release of WSF/Perl (Perl bindings for a WS-* framework) October 4, 2007, 1:37 am
How can I call MFC functions from Perl July 19, 2005, 9:46 pm
Calling external dll from inline perl using gcc on XP May 19, 2006, 2:48 am
Calling External DLL functions in Perl using Inline July 11, 2005, 6:47 am
Error calling Win32::Printer from a perl script hosted in IIS on Win2k3 June 3, 2008, 8:53 am
Error calling Win32::Printer from a perl script hosted in IIS on Win2k3 June 3, 2008, 8:57 am
PLJava need help September 1, 2004, 8:51 pm
Initial release of Kx-0.0.1 August 10, 2007, 6:53 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap