fix: restore CPAN regressions (eval return, regex \e, require return value)#851
Merged
Conversation
Fix three unrelated regressions from cpan_random_tester: skip hash/array cleanup on return registers so eval_closure subs can return %hash; translate Perl \e/\a escapes and exclude them from required-literal prefilter; accept require when $Package::VERSION is truthy even if the .pm file's last statement is not true. Generated with [Cursor](https://cursor.com) Co-Authored-By: Cursor <cursoragent@cursor.com>
Perl returns the last runtime expression from do FILE, not a $VERSION fallback. Exclude use/no CompilerFlagNodes and compile-time sub declarations from block return values so modules like Text::Patch (our $VERSION before use warnings) return 1.8 correctly. Replace require_version_fallback.t with require_module_return.t. Generated with [Cursor](https://cursor.com) Co-Authored-By: Cursor <cursoragent@cursor.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
return %hashin eval-generated subs by skipping scope cleanup on the return-value register (restores DateTime/Specio stack and Params::ValidationCompiler)\e/\aescapes: translate to\x1B/\x07and exclude from required-literal prefilter (restores Text::ANSI::Util and Text::ANSITable)do/requirereturn values: preserve the last runtime expression and ignore compile-time statements (use/nopragmas viaCompilerFlagNode,subdeclarations). This restores Text::Patch and similar modules that setour $VERSION = '...'without a trailing1;— matching Perl 5 (pp_leaveevaltruth check), not a$VERSIONfallbackTest plan
make(unit tests pass)do Text/Patch.pmreturns1.8require Text::Patchsucceeds without trailing1;0;last statement still fails requirejcpan -t Text::Patch— PASSjcpan -t Text::ANSI::Util— PASSjcpan -t Text::ANSITable— PASSjcpan -t DateTime::Format::Mail— PASSjcpan -t DateTime::Format::MySQL— PASSjcpan -t DateTimeX::Web— PASS