Modifying the @INC to include a code ref wouldn't allow for this - you merely return the code (via a filehandle), but at this point, it hasn't been compiled, so you can't interact with it yet.
Oh, but you can :-). You just have to do a bit of work. I just recently described this in Re^3: Notification on module load, and redefinition of module methods.. Enjoy!
lodin
In reply to Re^5: Overriding the built-in require function (@INC)
by lodin
in thread Overriding the built-in require function
by /dev/urandom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |