Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Perl implementation in Java?

Tags:

java

perl

I am looking for Perl implementation in Java. Something like Jython is for Python. I found PLJava but it needs both JVM and Perl compiler installed. I need something which does not need a Perl compiler.

I need to run some Perl code in a Java class.

UPDATES:

  • I figured out that PLJAVA is what I need. Does anybody know some tutorial?
  • Has anybody played with the Inline::Java module.
  • I also could not install Inline::Java.
like image 625
Ilija Avatar asked Mar 06 '09 18:03

Ilija


People also ask

What is Java Perl?

Perl is a cross-platform environment and library for running JavaScript applications which is used to create network and server-side applications.

Is Perl similar to Java?

Perl is a high-level, general-purpose, multi-paradigm, interpreted, dynamic programming language. Java is a high-level, general-purpose, mostly single-paradigm, statically typed programming language.

Is Perl faster than Java?

For the first pattern, Perl is about 10X faster than Java; for the second, they are about the same. In general, Perl uses a backtrack regex engine. Such an engine is flexible, easy to implement and very fast on a subset of regex.


1 Answers

Jython isn't fully compatible with CPython (or whatever you would rather call the original C++ Python interpreter), but wherever either differs from the language spec is a bug. Unfortunately, Perl 5 is much more complex and lacks any formal language specifications at all -- the language effectively being defined as "what does the perl executable do" -- so there exists no other implementation of the Perl 5 language aside from the Perl 5 interpreter. Unfortunate, but that's history. Perl 6 does have a language spec and multiple (incomplete) implementations, but that's not likely to be useful to you.

PLJava was an attempt to do exactly what you want, call Perl from Java. It does so via JNI (stuffing native code into Java) linking to libperl. However, it's not been updated since 2004 and I don't know how well it works.

Edit

I hadn't seen Inline::Java::PerlInterpreter before -- unfortunately it doesn't seem to work with my system Perl.

like image 156
ephemient Avatar answered Oct 12 '22 01:10

ephemient