Skip to content

Commit fb9242b

Browse files
fglockDevin
andcommitted
Update cpan_client.md - symbol table dereference bug is fixed
- Symbol table dereference (${ $Pkg::{NAME} }) now works correctly - DateTime still blocked by namespace::autoclean dependency - Updated investigation commands and next steps Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
1 parent 49404c3 commit fb9242b

1 file changed

Lines changed: 38 additions & 52 deletions

File tree

dev/design/cpan_client.md

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ cpan> install Module::Name
530530

531531
---
532532

533-
## Phase 11: DateTime Dependency Investigation (2026-03-19)
533+
## Phase 11: DateTime Dependency Investigation (2026-03-19, UPDATED)
534534

535535
### Problem Statement
536536

@@ -540,60 +540,57 @@ When running `jcpan install DateTime`, CPAN reports "DateTime is up to date (1.6
540540

541541
However, when actually using DateTime, the CPAN-installed `DateTime.pm` fails to load due to missing dependencies.
542542

543-
### Dependency Chain Analysis
543+
### Current Status (Updated 2026-03-19)
544+
545+
**Symbol table dereference bug: FIXED**
546+
547+
```perl
548+
# Now works correctly
549+
./jperl -e 'package Foo; our $VERSION = "1.0"; print ${ $Foo::{VERSION} }, "\n"'
550+
# Output: 1.0
551+
```
552+
553+
**New blocker discovered**: Package::Stash::PP doesn't return a true value.
554+
555+
```
556+
Could not find a suitable Package::Stash implementation:
557+
Can't locate Package/Stash/XS.pm
558+
Package/Stash/PP.pm did not return a true value
559+
```
560+
561+
### Dependency Chain Analysis (Updated)
544562
545563
```
546564
DateTime.pm
547565
├── namespace::autoclean 0.19
548-
│ └── B::Hooks::EndOfScope (XS - MISSING)
566+
│ └── namespace::clean
567+
│ └── Package::Stash
568+
│ └── Module::Implementation
569+
│ ├── ${ $stash{NAME} } - FIXED
570+
│ └── Package::Stash::PP - BROKEN (doesn't return true)
549571
├── Params::ValidationCompiler 0.26 ✓
550-
├── Specio::Subs
551-
│ └── Specio
552-
│ └── Module::Implementation
553-
│ └── BUG: ${ $Package::{NAME} } returns empty
572+
├── Specio::Subs ✓ (after Package::Stash fix)
554573
├── Try::Tiny ✓
555574
├── DateTime::Locale 1.06
556575
├── DateTime::TimeZone 2.44
557576
└── POSIX (built-in) ✓
558577
```
559578
560-
### Root Cause: Symbol Table Dereference Bug
561-
562-
**Bug discovered**: `${ $Package::{NAME} }` returns empty instead of the variable value.
563-
564-
```perl
565-
# PerlOnJava - BROKEN
566-
package Foo;
567-
our $VERSION = "1.0";
568-
my $glob = $Foo::{VERSION};
569-
print ${$glob}; # prints empty string (should print "1.0")
570-
571-
# Perl5 - WORKS
572-
package Foo;
573-
our $VERSION = "1.0";
574-
my $glob = $Foo::{VERSION};
575-
print ${$glob}; # prints "1.0"
576-
```
577-
578-
This bug blocks `Module::Implementation` which is used by `Specio` which is used by `DateTime`.
579-
580579
### Blocking Issues Summary
581580
582581
| Issue | Module Affected | Status |
583582
|-------|-----------------|--------|
584-
| `${ $stash{NAME} }` dereference | Module::Implementation | **BUG - needs fix** |
585-
| B::Hooks::EndOfScope (XS) | namespace::autoclean | XS module - needs stub or Java impl |
583+
| ~~`${ $stash{NAME} }` dereference~~ | ~~Module::Implementation~~ | **FIXED** |
584+
| Package::Stash::PP doesn't return true | Package::Stash | **BUG - needs investigation** |
586585
587586
### Proposed Solutions
588587
589-
#### Option A: Fix Symbol Table Dereference (Recommended)
588+
#### Option A: Fix Package::Stash::PP (Recommended)
590589
591-
Fix the bug where `${ $glob_from_stash }` doesn't properly dereference to the scalar value.
590+
Investigate why Package::Stash::PP.pm doesn't return a true value.
592591
593592
**Files to investigate:**
594-
- `RuntimeScalar.java` - scalar dereference
595-
- `RuntimeGlob.java` - glob handling
596-
- `GlobalContext.java` - symbol table access
593+
- `~/.perlonjava/lib/Package/Stash/PP.pm` - Check for compilation errors
597594
598595
#### Option B: Create Bundled DateTime.pm
599596
@@ -602,31 +599,20 @@ Create a simplified `DateTime.pm` in `src/main/perl/lib/` that:
602599
2. Uses our Java XS implementation or DateTime::PP
603600
3. Provides core DateTime functionality
604601
605-
This is a fallback if Option A is too complex.
606-
607-
#### Option C: Document DateTime as Requiring Manual Setup
608-
609-
Document that DateTime requires additional setup and can't be installed via jcpan directly.
610-
611602
### Investigation Commands
612603
613604
```bash
614-
# Test symbol table dereference
605+
# Test symbol table dereference (NOW FIXED)
615606
./jperl -e 'package Foo; our $VERSION = "1.0"; print ${ $Foo::{VERSION} }, "\n"'
607+
# Output: 1.0 (correct)
616608
617-
# Compare with Perl5
618-
perl -e 'package Foo; our $VERSION = "1.0"; print ${ $Foo::{VERSION} }, "\n"'
619-
620-
# Test Module::Implementation
621-
./jperl -e 'use Module::Implementation; print "OK\n"'
622-
623-
# Test DateTime after fix
609+
# Test DateTime - still blocked by namespace::autoclean
624610
./jperl -MDateTime -e 'print DateTime->now->ymd, "\n"'
611+
# Error: Can't locate namespace/autoclean.pm
625612
```
626613

627614
### Next Steps
628615

629-
1. **Investigate** `RuntimeScalar.java` and `RuntimeGlob.java` for scalar dereference from stash glob
630-
2. **Fix** the `${ $glob }` pattern when glob comes from `%Package::` stash
631-
3. **Test** Module::Implementation, Specio, DateTime in sequence
632-
4. **Alternative**: If fix is complex, create bundled DateTime.pm wrapper
616+
1. **Install namespace::autoclean dependencies** via jcpan to test further
617+
2. **If blocked by Package::Stash::PP**, investigate why modules ending with `sub foo { }` return undef
618+
3. **Alternative**: Create bundled DateTime.pm wrapper that skips heavy dependencies

0 commit comments

Comments
 (0)