Email::Stuff dependency chain: 5 PerlOnJava bug fixes#633
Merged
Conversation
d7017dd to
075a9b7
Compare
Two unrelated fixes uncovered while running `./jcpan -t Email::Stuff`:
1. ExtUtils/MakeMaker.pm: emit a no-op `ppd::` rule. Some Makefile.PLs
(notably MailTools' postamble) declare `all:: ppd`, which previously
broke MailTools' build with `make: *** No rule to make target 'ppd'`.
Real ExtUtils::MakeMaker generates a Win32 PPM .ppd descriptor; we
don't need PPM, but the target must exist so postambles work.
2. SubroutineParser: indirect-object syntax `new Class` followed by an
infix operator (`or`, `and`, `||`, `&&`, `==`, ...) or a statement
terminator (`;`, `)`, `}`, `]`, `,`, `?`, `:`) was being backtracked,
making the call collapse to a bare `new` identifier and producing a
confusing `syntax error ... near "or print ..."`. We now parse it as
a zero-argument `Class->new()` call and let the outer parser consume
the trailing operator. This fixes idioms like:
my $msg = new Mail::Send or print "not ";
my $m = new Mail::Mailer or warn;
which appear verbatim in MailTools' t/mailer.t and t/send.t.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…///) Continuation of fix/email-stuff-build. Three additional real PerlOnJava bugs found while running ./jcpan -t Email::Stuff: 1. ParserTables.OVERRIDABLE_OP: add `send`. Email::Send exports a sub named `send` that real Perl honours via typeglob assignment. PerlOnJava was rejecting `send(Test => $msg)` with "Not enough arguments for send" because it always enforced the socket builtin's prototype `*$$;$`. Adding `send` to OVERRIDABLE_OP makes the imported sub win, unblocking 5 Email::Send test files. 2. Base.importBase: tighten "already loaded" detection. `use base 'IO::Handle'` was skipping `require IO::Handle` because the Java backend pre-registers a few bridge stubs (IO::Handle::_sync etc.) in the global code-ref map, which made isPackageLoaded() return true. Realigned with real Perl's base.pm: only @isa or $VERSION counts as loaded; otherwise require. If require fails with "Can't locate" / "not found" AND the package has code refs in its stash, accept it (preserves the DBIC eval-package fix from before). Fixes Mail::Mailer's `$class->SUPER::new` which was failing because IO::Handle::new was never defined. 3. StringDoubleQuoted.applyCaseModifier: nested \L\u ordering. `s/\b(\w+)/\L\u$1/g` on "spickett" was producing "spickett" instead of "Spickett". The outer \L was being applied AFTER the inner \u, so the AST was lc(ucfirst($1)) — which lowercases the freshly-uppercased first char. Real Perl applies case modifiers per-character left-to- right; for `\L\u` the first char gets \u, the rest get \L, equivalent to ucfirst(lc($1)). Fix: when a single-char modifier (\u/\l) is applied inside a region modifier (\L/\U/\F/\Q), pre-wrap the segment with the outer's case function before wrapping with the single-char function, and remove the segment from the outer's tracking so it isn't re-wrapped. Fixes 6 subtests in MailTools/t/extract.t (Mail::Address->name uses `s/\b(\w+)/\L\u$1/igo` to title-case extracted names). Status with these fixes: MailTools make test: PASS (109/109; was crashing) Email::Send make test: 89/90 (1 subtest fails: chained shebang) Email::Stuff: still blocked by the chained shebang cascade — needs a native binary launcher for jperl. Documented in dev/modules/email_stuff.md as item 6. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
075a9b7 to
fd6a580
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
Five real PerlOnJava bugs fixed while running
./jcpan -t Email::Stuff. Thedistribution chain (
MailTools→Mail::Internet→Email::Send→Email::Stuff) is full of older Perl idioms; each failure exposed adistinct bug in the parser, runtime, or build glue.
System-perl baseline: 60/61 tests pass (the 1 failure is an unrelated
upstream Email::MIME header-quoting change).
ExtUtils/MakeMaker.pmppd::target —MailTools/Makefile.PL'sMY::postambleaddsall:: ppd, which mademakedie before anything was built. Added a no-op rule +.PHONYentry.SubroutineParsermy $x = new Foo or print "..."producedsyntax error ... near "or print ". Indirect-object branch backtracked past the class on infix-op lookahead. Now parses asFoo->new()and lets the outer parser consume the operator.ParserTablessendwas not inOVERRIDABLE_OP, soEmail::Send's exportedsend()was rejected with the socket builtin's prototype*$$;$(Not enough arguments for send). Addedsendto the override set.Base.javause base 'IO::Handle'skippedrequire IO::Handlebecause the Java backend pre-registers a few bridge stubs (IO::Handle::_syncetc.), which madeisPackageLoadedreturn true. Realigned with realbase.pm: only@ISAor$VERSIONcounts as loaded; otherwiserequire. If require fails withCan't locate/not foundAND code refs exist, accept the in-memory package (preserves the existing DBIC eval-class fix). FixesMail::Mailer's$class->SUPER::new.StringDoubleQuoteds/\b(\w+)/\L\u$1/gproducedlc(ucfirst($1))(lowercases the freshly-uppercased first char) instead ofucfirst(lc($1)). Real Perl applies modifiers per-character left-to-right — for\L\uthe first char gets\u, the rest get\L. FixedapplyCaseModifierto pre-wrap with the outer's case function before the single-char wrap. Fixes 6 subtests inMailTools/t/extract.t(Mail::Address->nameuses this idiom for title-casing).Net effect on
./jcpan -t Email::StuffMailToolsmakecrashed atppdtargetReturn::ValueEmail::SendFile::TypepreforkEmail::StuffRemaining blocker (out of scope, documented)
Email::Send/t/sendmail.twrites a fake sendmail with#!$^X(the path tothe
jperlbash wrapper) and execs it. macOS does not supportmulti-level shebang — the kernel returns
ENOEXECand the calling shellfalls back to interpreting the temp file as bash, producing
syntax error near unexpected token ;. Linux behaviour is similar.Fix requires replacing the bash wrapper with a small native binary
launcher (
jpackage/ C / Rust). Documented as item 6 indev/modules/email_stuff.mdwith future-proofing options.This single subtest failure cascades — CPAN.pm marks
Email::Sendasmake_test => NOand does not add itsblib/libto@INCforEmail::Stuff's tests, which then fail withCan't locate Email/Send.pm in @INC.Test plan
make(full unit-test suite) passes../jperl -e 'package Foo; sub new {...}; my $x = new Foo or die'no longer fails to parse../jperl -e 'BEGIN { *send = sub {...} } send;'calls the override../jperl -e 'package Foo; ... use base "Foo"'still works for in-memory base classes (DBIC pattern)../jperl -MIO::Handle -e 'use base "IO::Handle"; print Foo->new'works../jperl -e '$_ = "spickett"; s/(\w+)/\L\u$1/; print'printsSpickett../jcpan -t Email::Stuffreaches each distribution and the only remaining failure inMailTools/Email::Sendtest suites ist/sendmail.t(item 6).Files
src/main/perl/lib/ExtUtils/MakeMaker.pm—ppd::targetsrc/main/java/org/perlonjava/frontend/parser/SubroutineParser.java— indirect object + infixsrc/main/java/org/perlonjava/frontend/parser/ParserTables.java—sendoverridesrc/main/java/org/perlonjava/runtime/perlmodule/Base.java—use baserequire semanticssrc/main/java/org/perlonjava/frontend/parser/StringDoubleQuoted.java— nested case modifiersdev/modules/email_stuff.md— full plan / progress docsrc/main/java/org/perlonjava/core/Configuration.java— auto-updated commit infoGenerated with Devin