-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autouse misbehaves if target module is already loaded #15185
Comments
From @exodistCreated by @exodistautouse has a short-circuit when the module being processed is already autouse has 1 test file, inside a BEGIN it calls autouse->import('Scalar::Util' => 'Scalar::Util::prototype'); If Scalar::Util is not loaded (as is the case This is a problem for the upcoming Test::More which loads Scalar::Util. In I have not looked in-depth into why the test fail, or how exactly the -Chad Perl Info
|
From @exodistActually, it looks like I patched the test to delay loading Test::More back in 2014. The cpan version just needs to be updated to include the change. That said I think there is still a bug, and that the *fix* simply hid it. It looks like the short-circuit when a module is already loaded assumes that Exporter.pm is used as the exporter. It simply bumps $Exporter::ExportLevel, and then call $module->import. This will not work on modules that do not use Exporter.pm. The non-shortcircuit version actually checks if there is a custom import() and handles it properly. This can probably be fixed by changing line 28 to use goto to enter \&{"$module::import"} (some $@ management may also be needed) |
From @exodistOn Tue Feb 16 07:23:09 2016, exodist7@gmail.com wrote:
Scratch that, it doesn't blindly assume Exporter.pm. I am not sure where the bug is. |
From @exodistActually it looks like my 2014 patch was correct. The test is verifying that it cannot load Scalar::Util as Scalar::Util has a custom import(). Problem is that having Scalar::Util already loaded makes it fail too soon. So it appears the only bug is that the autouse version on cpan does not include the patch applied to blead in 2014. Can someone do a cpan release of the latest autouse and then close this ticket? -Chad |
From @jkeenanOn Tue Feb 16 07:27:43 2016, exodist7@gmail.com wrote:
I downloaded the latest version of the 'autouse' distribution from CPAN: http://search.cpan.org/CPAN/authors/id/W/WO/WOLFSAGE/autouse-1.08.tar.gz After unpacking the tarball I diff-ed it against dist/autouse/lib/autouse.pm in blead: #####
No difference; hence, nothing to be released (AFAICT).
Can you clarify? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @rjbsThe problem is in a test, not the module. -- |
From @rjbsI believe this is now fixed in latest. -- |
@rjbs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#127553 (status was 'resolved')
Searchable as RT127553$
The text was updated successfully, but these errors were encountered: