Fix CPAN prereq version detection and add missing module stubs#374
Merged
Conversation
The get_version() helper in ExtUtils::MM_Unix only matched $VERSION but not $Package::Name::VERSION. This caused modules like Dist::CheckConflicts that use the full package name in their version declaration to report version 'undef'. Updated the regex patterns to use /\$[\w:]*VERSION/ to match both: - $VERSION = '1.23' - $Dist::CheckConflicts::VERSION = '0.11' This fixes jcpan -t DateTime which was failing prerequisite checks due to incorrect version detection for Dist::CheckConflicts and CPAN::Meta::Check. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- re.pm: Add stub with VERSION for the built-in re pragma (implemented in Re.java). Fixes "re is not installed" prereq check errors. - Clone.pm: Add pure Perl fallback wrapper that loads Clone::PP when XSLoader fails. Clone is XS-only (no .pm files), so this provides a working Clone module for PerlOnJava. - open.pm: Add VERSION to stub for prereq detection. - B.pm: Fix VERSION to use numeric-only format (1.88) instead of 1.00_perlonjava which failed version->parse() validation. These changes fix `jcpan -t Specio` which was failing with: - Clone is not installed - re is not installed Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
When a built-in Java module (like UNIVERSAL, re, Clone) has a .pm stub file in the bundled lib, set %INC to the jar:PERL5LIB path format instead of just the module name. This allows code that opens %INC entries (like Test::Specio) to find a real file. Changes: - PerlModuleBase.initializeModule(): Check if .pm stub exists in JAR, use jar:PERL5LIB/Module.pm format if so - UNIVERSAL.pm: New stub file with VERSION for prereq detection This fixes Test::Specio tests that were failing with: "Could not open UNIVERSAL.pm for the test" Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes multiple CPAN module installation issues related to version detection and %INC paths.
Issue 1:
jcpan -t DateTimefailing with version 'undef'Root Cause:
get_version()inExtUtils::MM_Unix.pmonly matched$VERSIONbut not$Package::Name::VERSION.Fix: Updated regex patterns from
/\$VERSION/to/\$[\w:]*VERSION/to match both styles.Issue 2:
jcpan -t Speciofailing with missing modulesRoot Cause: These modules are built-in (Java implementations or XS-only), but the prereq check looks for .pm files with VERSION.
Fix: Added stub .pm files with VERSION declarations.
Issue 3: Test::Specio failing with "Could not open UNIVERSAL.pm"
Root Cause: Built-in Java modules set
%INC{'Module.pm'} = "Module.pm"(no path), but Test::Specio tries to open$INC{...}entries.Fix: Modified
PerlModuleBase.initializeModule()to check if a .pm stub exists in the JAR and usejar:PERL5LIB/Module.pmformat if so.Changes
version->parse())Test Plan
make)MM->parse_version()returns correct versionsjcpan -t DateTimeno longer reports version 'undef'jcpan -t Speciono longer reports Clone/re as missingGenerated with Devin