Perlito5 is an implementation of the Perl5 language that runs in the Java / JVM platform.
jrunscript now works with the "Perl5" language parameter:
$ jrunscript -cp .:perlito5.jar -l Perl5
perl> push @INC, "src5/lib"
1
perl> use Env qw/ HOME /;
perl> say $HOME
/Users/fglock
1
perl>
Perlito5 is an implementation of the Perl5 language that runs in the Java / JVM platform.
Perl scripts can now be run from inside Java applications using the standard javax.script API:
// $ javac -cp .:perlito5.jar Script.java
// $ java -cp .:perlito5.jar Script
import javax.script.*;
public class Script {
public static void main(String[] args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("Perl5");
Object o = engine.eval(" $x = 456; say 123 + $x; \"value was $x\" ");
System.out.println("result: " + o);
}
}
Perl modules can be loaded after setting @INC.
About 40 core modules have been ported to this distribution, and it passes about 23,000 tests.