Skip to content

CPAN Phase 1-4: Modules and Archive::Zip#314

Merged
fglock merged 1 commit into
masterfrom
feature/cpan-phase1-modules
Mar 14, 2026
Merged

CPAN Phase 1-4: Modules and Archive::Zip#314
fglock merged 1 commit into
masterfrom
feature/cpan-phase1-modules

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Mar 14, 2026

Summary

This PR implements CPAN Phase 1-4, adding essential modules for CPAN compatibility:

Phase 1: Low-hanging fruit

  • DirHandle, Dumpvalue, Sys::Hostname imported via sync.pl
  • flock() implemented using java.nio.channels.FileLock
  • syscall() implemented with gethostname support

Phase 2: Archive/Network modules

  • IO::Socket, IO::Socket::INET, IO::Socket::UNIX
  • IO::Zlib, Archive::Tar, Net::FTP
  • Socket.pm expanded with 20+ constants
  • SysHostname.java XS module
  • XSLoader caller() support

Phase 3: Process Control

  • IPC::Open2, IPC::Open3 using Java ProcessBuilder
  • pipe(), fcntl(), ioctl() operators
  • ProcessInputHandle/ProcessOutputHandle for process I/O

Phase 4: CPAN Client Evaluation & Archive::Zip

  • Archive::Zip implemented using java.util.zip
    • Read/write zip files
    • Add files, strings, directories
    • Extract individual or all members
  • cpanm analysis: Requires ExtUtils::MakeMaker (runs make) - not feasible for PerlOnJava
  • User documentation: docs/guides/using-cpan-modules.md

Bug fixes along the way

  • Regex octal escape parsing for \10-\377
  • Parser fix for @{${...}} nested dereference
  • defined *$var regression fix
  • Readline on undefined filehandle fix
  • Pipe I/O interruptible by alarm signals

Test plan

  • Archive::Zip: create, read, extract zip files
  • Zip files are valid (verified with system unzip)
  • Build passes: ./gradlew build -x test

Generated with Devin

- Add Archive::Zip Java implementation using java.util.zip
  - Read/write zip files
  - Add files, strings, and directories
  - Extract individual members or entire archive
  - Full member accessors (fileName, contents, size, etc.)
- Create user documentation for CPAN modules (docs/guides/using-cpan-modules.md)
- Update cpan_client.md design doc with Phase 4 completion
- Document cpanm analysis: requires ExtUtils::MakeMaker which is infeasible

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
@fglock fglock merged commit c6b2fd8 into master Mar 14, 2026
2 checks passed
@fglock fglock deleted the feature/cpan-phase1-modules branch March 14, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant