-
Notifications
You must be signed in to change notification settings - Fork 550
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
sub refs returned from @INC hooks receive wrong parameters #12569
Comments
From @haargCreated by @haarg@INC hooks can return a filehandle, a subroutine reference, and an The documentation for require specifies that this sub will receive $ cat require-feed-sub.pl unshift @INC, sub { require test; Perl Info
|
From @jkeenanOn Thu Nov 15 19:26:41 2012, haarg wrote:
I don't claim to understand these @INC hooks very well, but the documentation for 'require' in perl-5.22.0 seems to me to be saying something different from what you are claiming: ##### You state that the second argument is "the optional state." The documentation says the second argument should be a file name. Can you clarify? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @cowensThe part you are quoting is for the first layer of subroutines. The Subroutine references are the simplest case. When the inclusion 1 A reference to a scalar, containing any initial source code to 2 A filehandle, from which the file will be read. 3 A reference to a subroutine. If there is no filehandle 4 Optional state for the subroutine. The state is passed in as Specifically, return values 3 and 4. The coderef returned should get I am not sure why the documentation and behavior seem to be out of On Sat, Aug 1, 2015 at 9:27 PM, James E Keenan via RT
-- |
From @jkeenanOn Sat Aug 01 21:38:32 2015, cowens wrote:
[snip]
Yes, this is starting to sound like a situation where we should change the documentation to match the behavior -- but we should still know what the use case is (or, more likely, was). Thank you very much. -- |
From @haargI think adjusting the docs to match the code is probably the best idea. I only ran into this issue because I was trying to re-implement the behavior of require. I don't see any real value to passing the subref in as a parameter. |
From @cowensThe actual call to the code is near the end of pp_require in pp_ctl.c: if (filter_sub || filter_cache) { /* switch to eval mode */ SAVECOPLINE(&PL_compiling); PUTBACK; if (doeval(gimme, NULL, PL_curcop->cop_seq, NULL)) I can't read the internals well enough to understand what is going on here. |
From @cowensYeah, I am just trying to figure out what that 0 represents so the I think, and this is a pretty big supposition as well, that this stuff On Sun, Aug 2, 2015 at 11:48 AM, Graham Knop via RT
-- |
From @ap* Graham Knop via RT <perlbug-followup@perl.org> [2015-08-02 17:50]:
And if there’s any then it’s been covered by __SUB__ since 5.16 anyway. |
From zefram@fysh.orgThe zero argument is just a constant zero, and always -zefram |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#115754 (status was 'resolved')
Searchable as RT115754$
The text was updated successfully, but these errors were encountered: