perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

Implement fatalization of import/unimport method with argument

Open jkeenan opened this issue 3 days ago • 6 comments

This commit is mostly a manual reversion of commit f1cf82e. Return to a perl_croak in universal.c; adjust regen/warnings.pl as needed; run 'make regen'; get t/op/universal.t passing. No documentation changes yet.

Add test for undefined unimport method, then refactor repeated code into a subroutine. Perform a pattern match rather than a string equality test because testing for exact line numbers inside a test program too fragile for maintenance purposes.

Still one porting test failure.

This should be considered a first draft of a pull request to implement GH #23623.

I believe I have implemented the "ask" of GH #23623, but there is one test failure in t/porting/diag.t I have not yet been able to resolve. In t/op/universal.t I have written tests to match the message emitted by the newly fatalized import and unimport cases in universal.c, but I have not yet been able to get t/porting/diag.t to recognize that that exception message is indeed documented in pod/perldiag.pod.

$ cd t;./perl harness porting/diag.t; cd -
porting/diag.t .. 1839/? # Failed test 2181 - Attempt to call undefined %s method with arguments via package "%s" (Perhaps you forgot to load the package?) at porting/diag.t line 589
#     Message 'Attempt to call undefined %s method with arguments via package "%s" (Perhaps you forgot to load the package?)'
#     from universal.c line 454 is not listed in pod/perldiag.pod
porting/diag.t .. Failed 1/2368 subtests 

Suggestions welcome.

I have not yet made any attempt to estimate the impact of this code change on code on CPAN or out in the wild. If anyone wants to work with me on that, please contact me.

NOTE: Other things being equal, I would prefer to see the pull request for goto-partial-fatal, GH #23782, prioritized for review and merging.

Will need a perldelta entry.

@haarg

jkeenan avatar Dec 08 '25 23:12 jkeenan