Skip to content
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

@INC hooks ignore AUTOLOAD #20665

Closed
haarg opened this issue Jan 3, 2023 · 0 comments · Fixed by #20766
Closed

@INC hooks ignore AUTOLOAD #20665

haarg opened this issue Jan 3, 2023 · 0 comments · Fixed by #20766
Assignees

Comments

@haarg
Copy link
Contributor

haarg commented Jan 3, 2023

AUTOLOAD methods on objects in @INC are not called by perl 5.37.7.

I'm not sure what the best behavior here is, but I see two possible solutions. First is to not change anything and just document that AUTOLOAD is ignored for this case. Second is checking for an AUTOLOAD method after checking for INC, INCDIR, and string overloads, and if it exists calling it for INC.

Steps to Reproduce

perl -E'package AutoHook { sub DESTROY {} sub AUTOLOAD { say our $AUTOLOAD; return; } } unshift @INC, bless {}, "AutoHook"; require strict;'

On perl 5.36.0 this produces:

AutoHook::INC

On perl 5.37.7 this produces no output.

tonycoz added a commit to tonycoz/perl5 that referenced this issue Feb 2, 2023
This matches the behaviour in 5.36.

This does not allow AUTOLOAD for INCDIR, since if there is an AUTOLOAD
the check for INC would have already succeeded.

Fixes Perl#20665
tonycoz added a commit that referenced this issue Feb 8, 2023
This matches the behaviour in 5.36.

This does not allow AUTOLOAD for INCDIR, since if there is an AUTOLOAD
the check for INC would have already succeeded.

Fixes #20665
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
This matches the behaviour in 5.36.

This does not allow AUTOLOAD for INCDIR, since if there is an AUTOLOAD
the check for INC would have already succeeded.

Fixes Perl#20665
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
This matches the behaviour in 5.36.

This does not allow AUTOLOAD for INCDIR, since if there is an AUTOLOAD
the check for INC would have already succeeded.

Fixes Perl#20665
khwilliamson pushed a commit to khwilliamson/perl5 that referenced this issue Jul 10, 2023
This matches the behaviour in 5.36.

This does not allow AUTOLOAD for INCDIR, since if there is an AUTOLOAD
the check for INC would have already succeeded.

Fixes Perl#20665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants