> > "Why do you even need a hook if your require happens right away?"
a require is basically a
> I don't need to write individual X/Y/Z.pm modules for require X::Y::Z statements.
you don't need to save them to a file.
Just eval the code and update %INC
> > "Why are you installing multiple hooks?"
A hook is an abstraction of a directory path in @INC, which are searched sequentially.
Either a path includes a requested module (SUCCESS) or the next is searched (FAIL)
But your hook in the OP always returned the same code of the first module, no matter which module was requested. It should have signaled a FAIL, to allow the next path/hook to handle the request.
And each of your hooks is only returning one file, which is an overkill and "littering" @INC with hooks.
> Perhaps you would share your understanding.
If you want you can look into the working example I wrote for HaukeX' webperl project:
[WEBPERL] dynamically importing non-bundled modules via http
you just have to adapt the coderef $fetch and %INC_FETCH to your needs.
BUT as I said, you don't even need hooks if you eval those modules right away.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: require() @INC hooks problem
by LanX
in thread require() @INC hooks problem
by kcott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |