Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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".


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (4)
    As of 2014-12-28 22:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (183 votes), past polls