in reply to Calling perl from java

...here's another possibility. Certainly JNI is an excellent way to call native functions (such as those in the Perl libraries) directly from a class file, but I will bet that your scripts don't convert easily into something that would work this way.

And what would be easiest varies from programmer to programmer. (When someone tells me what "would just be the easiest" I translate that to mean "if I had to do the job, it would be easiest to...")

And I'm willing to bet that the use of regexes in your existing scripts will not translate well to Java Patterns due to the many nuances of regex implementation in Perl and our inability to avoid using those nuances over and over again.

So what I was thinking would do the trick is to build a small network server in Perl that is launched at the same time as your application and which answers on a port known to your application. Then, when the time comes to call for a file operation, the Java class you provide will actually send a request to your already waiting Perl server which would process the job.

So if you find out from your application architects how to supply a Java class that will service the request, then write such a class that forwards the request to your Perl server. The server could be very simple, just listen on a designated port, then receive a formatted request to service a file, do that job and then go back to listening.

This would result in the elimination of the overhead caused by process creation. The Perl server could be simple enough to fit in about two printed pages of code, and it could provide the gateway to the rest of your scripts.

And you'd learn a great deal about both Perl and Java as you write it!

...All the world looks like -well- all the world, when your hammer is Perl.
---v