Branch: refs/heads/yves/import_error2deprecation Home: https://github.com/Perl/perl5 Commit: 907695add47edd07245abeb9f8065af8bbf458fa https://github.com/Perl/perl5/commit/907695add47edd07245abeb9f8065af8bbf458fa Author: Yves Orton <demer...@gmail.com> Date: 2023-07-25 (Tue, 25 Jul 2023)
Changed paths: M lib/warnings.pm M pod/perldeprecation.pod M regen/warnings.pl M t/op/universal.t M universal.c M warnings.h Log Message: ----------- universal.c - change import with args error to be a deprecated warning We have had a LOT of fallout from 2dcf3cf50d7 as it turns out that there various common cases of people accidentally exploiting the silent use of missing import with arguments. The premise of detecting this was that it would allow us to detect scenarios where users on a case-insensitive file-system had a typo. But it turns that there are a lot of accidental cases of this as well, a lot more than we expected. Common mistaken cases are: * Via use_ok() where people think the second argument is a test name instead of an argument to the import of the module being used. * Using a quoted version number in a version check instead of a true number. IE: use Foo '1.234'; gets passed to Foo->import() and not Foo->VERSION(). This is compounded by the fact that Exporter->import() *does* support a version check via import(). Arguably if we allow string versions (IMO we should) then we should deal with this in the parser, not in import() (although the latter is a little more debatable IMO). * Explicit calls to import() with a version number. * Mistakenly requesting an export from a module that doesn't actually export anything. One possible explanation for this case is that a module was at one point in its lifetime not a class, but then was later on turned into a class and the arguments to use statements weren't changed even though the main code was changed to use class syntax. Because of the scope of the breakage of the original error this patch downgrades the error to a depecation warning instead, with the intention that in 5.44 we will make it a hard error.