Resolve #2754 and #16300 - introduce a workaround for Module::Install::DSL and fixup return code for perl_parser() #20181
+64
−28
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.
In 0301e89 Zefram fixed a long standing bug #2754, and properly defined the exit code from perl_parse(). This however broke Module::Install::DSL as can be seen in issue #16300. The patch was reverted in 857320c. Module::Install is not easily upgradable due to its design, and there are still a lot of modules out there with the buggy use of INIT.
However, it turns out that the bugfix from #2754 allows us to fix other issues which we want to address.
So this PR reverts Zeframs revert and creates a simple workaround for the Module::Install::DSL issue. INIT blocks in the Module::Install::DSL namespace will magically be treated as BEGIN blocks. This means that they will be executed inside of the eval that Module::Install::DSL creates, and executed as expected, at the same time a warning is produced to show the workaround has been triggered.
The check for this is quite efficient so it should not be noticeable outside of the special case it is meant to work around.
This will enable us to fix Issue: #20161 and potentially also apply PR #20168