https://github.com/fglock/perlonjava
An implementation of the Perl programming language designed to run on the Java platform
https://github.com/fglock/perlonjava
Last synced: 4 months ago
JSON representation
An implementation of the Perl programming language designed to run on the Java platform
- Host: GitHub
- URL: https://github.com/fglock/perlonjava
- Owner: fglock
- License: other
- Created: 2024-08-02T19:02:42.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-10-27T20:16:45.000Z (8 months ago)
- Last Synced: 2024-10-27T23:28:47.714Z (8 months ago)
- Language: Java
- Size: 2.92 MB
- Stars: 18
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PerlOnJava: A Perl Distribution for the JVM
PerlOnJava provides a Perl distribution designed to run natively on the Java Virtual Machine (JVM).
It allows Perl scripts to integrate seamlessly with Java-based ecosystems while offering familiar tools and modules for Perl development.The JAR package features a variety of Perl modules, such as `DBI` (with JDBC support), `HTTP::Tiny`, `JSON`, `YAML`, `File::Find`, and `Data::Dumper`.
Users can also add their own database JDBC drivers, making it a flexible solution for cross-platform Perl applications.## Table of Contents
1. [Introduction](#introduction)
2. [Why PerlOnJava](docs/WHY_PERLONJAVA.md)
3. [Target Audience](#target-audience)
4. [Quick Start](#quick-start)
5. [Features and Limitations](docs/FEATURE_MATRIX.md)
6. [Build Instructions](docs/BUILD.md)
7. [Running with Docker](docs/DOCKER.md)
8. [Running the JAR File](#running-the-jar-file)
9. [Debugging Tools](#debugging-tools)
10. [Architecture](docs/ARCHITECTURE.md)
11. [Porting Modules](docs/PORTING_MODULES.md)
12. [Milestones](MILESTONES.md)
13. [Community and Support](docs/SUPPORT.md)
14. [License](#license)
15. [Additional Resources](docs/RESOURCES.md)## Introduction
PerlOnJava bridges the gap between Perl and Java by providing a platform that compiles Perl scripts into Java bytecode, making them executable on the JVM.
By leveraging this distribution, developers can run familiar Perl code while accessing Java's ecosystem of libraries and tools.
This project aims to bring the strengths of Perl to modern JVM environments while supporting a growing list of core modules and pragmas.Need help? Check out our [Community and Support](docs/SUPPORT.md) section.
### What This Project Is
- **A JVM-Native Perl Implementation**: Runs Perl code directly on the Java Virtual Machine
- **A Bridge to Java Ecosystems**: Enables Perl scripts to interact with Java libraries and frameworks
- **A Cross-Platform Solution**: Provides consistent Perl behavior across different operating systems via JVM
- **A Modern Integration Tool**: Allows Perl codebases to participate in Java-based enterprise environments## Target Audience
- **Java Developers with Perl Knowledge**: Provides a method for integrating Perl scripts into Java applications.
- **Compiler and Language Enthusiasts**: Offers insights into translating high-level languages into JVM bytecode.
- **Experimenters and Tinkerers**: A tool for experimenting with language interoperability.## Quick Start
Get started quickly with PerlOnJava. For a complete list of capabilities, see our [Feature Matrix](docs/FEATURE_MATRIX.md).
1. Build the project ([detailed instructions](docs/BUILD.md)):
```bash
mvn clean package
```2. Run a simple Perl script:
Linux/Mac
```bash
./jperl -E 'say "Hello World"'
```Windows
```bash
jperl -E "say 'Hello World'"
```3. Use Perl in your Java application:
```java
import javax.script.*;
public class TestPerl {
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("perl");
engine.eval("print 'Hello from Java-integrated Perl!\n'");
}
}
```4. Connect to a database:
```perl
use DBI;
my $dbh = DBI->connect("jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1");
$dbh->do("CREATE TABLE test (id INT, name VARCHAR(50))");
$dbh->do("INSERT INTO test VALUES (1, 'Hello World')");
```## Running the JAR File
1. **Show Instructions**:
Linux/Mac
```bash
./jperl --help
```Windows
```bash
jperl --help
```2. **Execute Something**:
Linux/Mac
```bash
./jperl -E 'print 123'
```Windows
```bash
jperl -E "print 123"
```## Debugging Tools
1. **Execute Emitting Debug Information**:
Linux/Mac
```bash
./jperl --debug -E 'print 123'
```Windows
```bash
jperl --debug -E "print 123"
```2. **Compile Only; Can Be Combined with --debug**:
Linux/Mac
```bash
./jperl -c -E 'print 123'
./jperl --debug -c -E 'print 123'
```Windows
```bash
jperl -c -E "print 123"
jperl --debug -c -E "print 123"
```3. **Execute and Emit Disassembled ASM Code**:
Linux/Mac
```bash
./jperl --disassemble -E 'print 123'
```Windows
```bash
jperl --disassemble -E "print 123"
```4. **Run the Lexer Only**:
Linux/Mac
```bash
./jperl --tokenize -E 'print 123'
```Windows
```bash
jperl --tokenize -E "print 123"
```5. **Run the Parser Only**:
Linux/Mac
```bash
./jperl --parse -E 'print 123'
```Windows
```bash
jperl --parse -E "print 123"
```## License
This project is licensed under the Perl Artistic License 2.0 - see the [LICENSE](LICENSE.md) file for details.
