Branch: refs/heads/yves/require_hook_rebased Home: https://github.com/Perl/perl5 Commit: cb50573fae3e7acff9e60984b062a34dae0c666a https://github.com/Perl/perl5/commit/cb50573fae3e7acff9e60984b062a34dae0c666a Author: Yves Orton <demerphq@gmail.com> Date: 2023-03-14 (Tue, 14 Mar 2023) Changed paths: M MANIFEST R t/lib/GH_15109/Apack.pm R t/lib/GH_15109/Bpack.pm R t/lib/GH_15109/Cpack.pm R t/lib/GH_15109/Foo.pm A t/lib/caller/Apack.pm A t/lib/caller/Bpack.pm A t/lib/caller/Cpack.pm A t/lib/caller/Foo.pm M t/op/caller.t Log Message: ----------- t/lib/GH_15109 - rename to t/lib/caller I want to use these modules in other tests, so changing the name makes sense. Commit: b9c62508fd0a939faf005a2508f528c684dd2f6e https://github.com/Perl/perl5/commit/b9c62508fd0a939faf005a2508f528c684dd2f6e Author: Yves Orton <demerphq@gmail.com> Date: 2023-03-14 (Tue, 14 Mar 2023) Changed paths: M regen/mg_vtable.pl Log Message: ----------- regen/mg_vtable.pl - rename confusing var %sig to %vtable_conf Commit: ebc22e54678e9139d4c7237bb4163f57f67af7bc https://github.com/Perl/perl5/commit/ebc22e54678e9139d4c7237bb4163f57f67af7bc Author: Yves Orton <demerphq@gmail.com> Date: 2023-03-14 (Tue, 14 Mar 2023) Changed paths: M MANIFEST M embed.fnc M embed.h M embedvar.h M gv.c M intrpvar.h M mg.c M mg_names.inc M mg_raw.h M mg_vtable.h M perl.c M pod/perldiag.pod M pod/perlfunc.pod M pod/perlguts.pod M pod/perlvar.pod M pp_ctl.c M proto.h M regen/mg_vtable.pl M sv.c A t/lib/caller/Bicycle.pm A t/lib/caller/Cycle.pm A t/lib/caller/Tricycle.pm M t/op/glob.t A t/op/hook/require.t Log Message: ----------- pp_ctl.c - add support for hooking require. This defines a new magic hash C<%{^HOOK}> which is intended to be used for hooking keywords. It is similar to %SIG in that the values it contains are validated on set, and it is not allowed to store something in C<%{^HOOK}> that isn't supposed to be there. Hooks are expected to be coderefs (people can use currying if they really want to put an object in there, the API is deliberately simple.) The C<%{^HOOK}> hash is documented to have keys of the form "${keyword}__${phase}" where $phase is either "before" or "after" and in this initial release two hooks are supported, "require__before" and "require__after": The C<require__before> hook is called before require is executed, including any @INC hooks that might be fired. It is called with the path of the file being required, just as would be stored in %INC. The hook may alter the filename by writing to $_[0] and it may return a coderef to be executed *after* the require has completed, otherwise the return is ignored. This coderef is also called with the path of the file which was required, and it will be called regardless as to whether the require (or its dependencies) die during execution. This mechanism makes it trivial and safe to share state between the initial hook and the coderef it returns. The C<require__after> hook is similar to the C<require__before> hook however except that it is called after the require completes (successfully or not), and its return is ignored always. Compare: https://github.com/Perl/perl5/compare/84e5fed47b5a...ebc22e54678e