Skip to content

Commit 2eb127d

Browse files
committed
slides review
1 parent dcf213e commit 2eb127d

1 file changed

Lines changed: 151 additions & 0 deletions

File tree

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# PerlOnJava — Integration & Future
2+
3+
## Making Perl a First-Class JVM Citizen
4+
5+
German Perl/Raku Workshop 2026 — Flavio Glock
6+
7+
*Part 3: Integration, tooling, and roadmap (10min)*
8+
9+
---
10+
11+
## XSLoader: Java Instead of C
12+
13+
- Loads **Java extensions** instead of C shared libraries
14+
- **jnr-posix** replaces XS for native POSIX calls
15+
- No C compiler needed
16+
17+
Note:
18+
Java equivalents are easier to write and maintain than C/XS. The same API surface is exposed to Perl code.
19+
20+
---
21+
22+
## Module Loading
23+
24+
`require` converts `Module::Name``Module/Name.pm`, searches `@INC`, caches in `%INC`.
25+
26+
**300+ modules bundled inside the JAR:**
27+
```text
28+
%INC: 'Data/Dumper.pm' =>
29+
'file:/path/to/perlonjava.jar!/lib/Data/Dumper.pm'
30+
```
31+
32+
---
33+
34+
## JSR-223: Embed Perl in Java
35+
36+
JSR-223 is the standard Java scripting API (JDK since Java 6).
37+
38+
```java
39+
ScriptEngineManager manager = new ScriptEngineManager();
40+
ScriptEngine perl = manager.getEngineByName("perl");
41+
42+
perl.put("data", myJavaObject);
43+
Object result = perl.eval("process_data($data)");
44+
```
45+
46+
**Bidirectional:** Java ↔ Perl seamlessly.
47+
48+
**Use case:** Embed legacy Perl scripts in a modern Java application without rewriting them.
49+
50+
---
51+
52+
## Future Targets
53+
54+
**Current:** Standard JVM (HotSpot)
55+
56+
1. **GraalVM** — native executables, instant startup
57+
2. **Android DEX** — Perl on mobile devices
58+
59+
The Internal VM is key — custom bytecode is portable to any JVM derivative.
60+
61+
Note:
62+
Dual backend matters beyond performance. GraalVM gives standalone executables. Android DEX converts JVM to Dalvik bytecode.
63+
64+
---
65+
66+
## Interactive Debugger
67+
68+
**Invoke with `-d` flag:** `./jperl -d script.pl`
69+
70+
```text
71+
n Step over (next line)
72+
s Step into subroutine
73+
r Step out (return)
74+
c Continue to breakpoint
75+
b 42 Set breakpoint at line 42
76+
l List source around current line
77+
T Stack trace
78+
p $var Print variable value
79+
```
80+
81+
Supports `$DB::single`, `@DB::args`, `%DB::sub`, and custom `DB::DB` via `PERL5DB`.
82+
83+
Note:
84+
Debugger uses Internal VM (forced with -d). DEBUG opcodes inserted at each statement. DebugHooks handles breakpoints, command parsing, and eval in current scope. PERL5DB supported for custom debuggers.
85+
86+
---
87+
88+
## Current Limitations
89+
90+
**JVM-incompatible:**
91+
- `fork` — not available on JVM
92+
- `DESTROY` — JVM uses non-deterministic GC
93+
- Threading — not yet implemented
94+
95+
**Partially implemented:**
96+
- Some regex features, taint checks
97+
98+
Note:
99+
Workarounds: jnr-posix for native access, Java threading APIs, file auto-close at exit. XS modules use Java equivalents.
100+
101+
---
102+
103+
## Roadmap
104+
105+
**Stable now:** JVM backend, Perl class features, IPC, sockets, interactive debugger
106+
107+
**In progress:** Internal VM optimization, eval STRING performance
108+
109+
**Next:** More compatible regex engine, additional debugger features
110+
111+
---
112+
113+
# Closing
114+
115+
---
116+
117+
## Perl Was Never Designed to Run on the JVM
118+
119+
We made it work anyway — and made it **fast**.
120+
121+
<span class="metric">~200,000 tests</span> · <span class="metric">400 files</span> · <span class="metric">6,000 commits</span>
122+
123+
No formal spec exists. The tests **are** the specification.
124+
125+
Note:
126+
This is test-driven development at its most extreme — tests define the language behavior.
127+
128+
---
129+
130+
## Get Involved
131+
132+
**GitHub:** github.com/fglock/PerlOnJava · **License:** Artistic 2.0
133+
134+
- **Test** your scripts and report issues
135+
- **Port** CPAN modules
136+
- **Contribute** to core development
137+
138+
---
139+
140+
## Thank You!
141+
142+
**Special thanks to:**
143+
144+
- **Larry Wall** — for creating Perl
145+
- **Perl test writers** — tests that define Perl's behavior
146+
- **Perl community** — for decades of innovation
147+
- **Prior pioneers** — JPL, perljvm, Perlito5
148+
149+
**Questions?** → github.com/fglock/PerlOnJava/issues
150+
151+
---

0 commit comments

Comments
 (0)