How to transfer data from Perl to Java?

I am working on some Java ↔ Perl interaction. I would like to know what is the best way to pass information from Perl to Java. (Great answers to questions about Perl and Java here and here, by the way.)

There is a lot of text and XML (XML :: Twig). I understand Perl, in a script, I have to call from the Java Web App. Therefore, I have all this data collected, and I need it to use it inside certain objects in Java.

What could be a good strategy for sending information from Perl to Java? Is it possible to return an object or other compatible data structure from Perl to Java?

I assume that writing to a text file and reading it from Java will make all the optimization obtained with Perl pointless.

Perlformance is an important issue.

EDIT: From what I saw here , maybe Inline-Java would be a good option?

+5
source share
5 answers

If performance is important, I would recommend using a persistent Perl process. Running the Perl interpreter every time you want to run your code will be pretty overhead.

The easiest way to communicate is to force a Java process to open a TCP connection with Perl processes, write some data, and retrieve it.

, Perl Java, , , , . XML- , , pack Perl, a DataInputStream Java .

+5

JSON - .

Rhino - ( ), , .

+3

XML, .

+2

Inline::Java. , . , - Perl, Java SOAP- , . , Inline:: Java , . , , ( , ), - . !

+2

, Perl- XML , java. , , , , . perl, , , , , - .

XML java? DOM , JDOM castor, SAX. , , XML (jwz ).

In any case, I would recommend using the profiler with your Java code first to see if it can be improved.

0
source

All Articles