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

From: Graciliano M. P. (gmpowers_at_terra.com.br)
Date: 07/13/04

  • Next message: mei: "Re: how to display html in email message body with mime:: entity"
    Date: 13 Jul 2004 03:06:30 -0700
    
    

    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

         }

      }


  • Next message: mei: "Re: how to display html in email message body with mime:: entity"

    Relevant Pages

    • Re: About blackdown
      ... >> for Linux, OSX, and Windows, with all executable and library files in one ... >> or a few directories on an install CD, ... Then I saw "Learning Perl" on special for $7 at a store. ... But Java has worked well and I like Perl. ...
      (Debian-User)
    • Re: Is perl better? :(((
      ... >> Wasthe original PERL script hitting an Oracle database? ... >> Did you run an explain plan on your Oracle SQL? ... Java and perl on another. ...
      (comp.lang.java.databases)
    • Re: Is perl better? :(((
      ... >> Wasthe original PERL script hitting an Oracle database? ... >> Did you run an explain plan on your Oracle SQL? ... Java and perl on another. ...
      (comp.lang.java.programmer)
    • Re: Is perl better? :(((
      ... Oracle on one box, Java and perl on another. ... See previous answer about SQL. ...
      (comp.lang.java.databases)
    • Re: Is perl better? :(((
      ... Oracle on one box, Java and perl on another. ... See previous answer about SQL. ...
      (comp.lang.java.programmer)