Merged
Conversation
Adds src/main/perl/lib/common/sense.pm so `use common::sense` works
out of the box. Implements all the behaviours of the upstream module:
strict, utf8, the FATAL warning categories common::sense enables,
the lenient warnings it suppresses (exec/newline/unopened), and the
features it turns on (say, state, switch, fc, evalbytes, current_sub,
unicode_strings).
Upstream's sense.pm is generated at install time from sense.pm.PL and
mutates ${^WARNING_BITS} and $^H directly. PerlOnJava's parser doesn't
fully honor mid-script %^H feature mutations from a bundled .pm loaded
via `use`, so we use the high-level pragmas (strict/warnings/feature/
utf8) instead. End result is identical from the user's perspective.
Verified:
- ./jcpan -t common::sense -> Result: PASS (both upstream tests).
- make passes.
Per the CPAN compatibility report, common::sense is a direct dependency
of ~19 modules (CBOR::XS, AnyEvent::HTTP, Types::Serialiser, etc.) and
many more transitively, so this unblocks a meaningful chunk of CPAN.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
0ff5901 to
33badb0
Compare
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
Bundles a full implementation of
common::sensesouse common::sense;works out of the box in PerlOnJava.Per the CPAN compatibility report (refreshed in this PR),
common::senseis a direct dependency of ~19 modules (CBOR::XS, AnyEvent::HTTP, Types::Serialiser, JSON::XS::VersionOneAndTwo, several Catalyst plugins, etc.) and many more transitively. Previously its install failed because upstream'ssense.pmis generated at build time fromsense.pm.PL, which PerlOnJava's installer doesn't run — so every dependent failed atCan't locate common/sense.pm.What it does
src/main/perl/lib/common/sense.pmreproduces all the behaviours of upstream common-sense 3.75:use strict(vars/refs/subs)use utf8use warnings FATAL => qw(closed threads internal debugging pack malloc prototype inplace io pipe unpack glob digit printf layer reserved taint closure semicolon)no warnings qw(exec newline unopened)use feature qw(say state switch fc evalbytes current_sub unicode_strings)Why high-level pragmas instead of
${^WARNING_BITS}/$^HmutationUpstream
sense.pmmutates${^WARNING_BITS}and$^Hdirectly via byte-level masks. PerlOnJava's parser honors that for inline-Escripts but not reliably when mutated mid-compile from a.pmloaded viausefrom a script file. Using the high-level pragmas (strict->import,feature->import, etc.) propagates the lexical state into the caller's scope on both code paths.Verification
./jcpan -t common::sense→ Result: PASS (both upstream tests pass:t/00_load.t,t/01_arch.t).say/fc/stateare all active in the caller's package afteruse common::sense;(tested in bothmainand other packages).uninitializedis not warned (matches upstream)../jcpan -t Types::Serialiser(a downstream dependent) successfully resolves thecommon::senseprereq and proceeds to its own tests.makepasses.Note on stale installs
@INClists~/.perlonjava/libbefore the bundled JAR. If a user previously had a partially-installed~/.perlonjava/lib/common/sense.pmfrom before this change, it would shadow the bundled version. The fix isrm -f ~/.perlonjava/lib/common/sense.pm. New installs / clean machines are unaffected —jcpan's MakeMaker shim auto-detects the JAR-bundled module and skips installing the.pm(it still installssense.pod).Test plan
make(build + unit tests) passes./jcpan -t common::sensePASSTypes::Serialiserresolves the depFiles
src/main/perl/lib/common/sense.pm— newdev/cpan-reports/cpan-compatibility{.md,-pass.dat,-fail.dat}— refreshed reportGenerated with Devin