Subject: | Use a code ref in @INC instead of CORE::GLOBAL::require? |
Hi,
We're looking at using this as part of perl5i. See
https://github.com/schwern/perl5i/issues/217
I have a concern that the warning is not lexical, leading to the
UNIVERSAL::isa problem. That can be fixed pretty easily, but
CORE::GLOBAL::require needs to be in effect at all times to track module
loads.
An alternative implementation is to put a code ref at the front of @INC
which tracks every time it's called. This leaves CORE::GLOBAL::require
clear. Now the problem is what if something gets put in front of our
tracker in @INC? Turns out every code ref in @INC will get called, even
if an earlier entry resolves the module.
What if @INC gets cleared? Make the tracker an object whose DESTROY
method puts a new object back. :-)
What do you think?