in reply to Re: Removing entries from @INC
in thread Removing entries from @INC

I have a perl script that starts another instance of perl interpreter, and I want the latter to inherit the original script's @INC.

The actual case is I'm testing (prove -l) a script in a Perl distribution which starts another perl script that requires a module in the current distribution. The latter script would fail to find the module because its @INC does not contain lib. Now in this specific case I can just add -Ilib option to the latter script's invocation when detecting some environment variable, but I'm curious about the more generic solution.

Replies are listed 'Best First'.
Re^3: Removing entries from @INC
by ikegami (Patriarch) on Feb 25, 2022 at 15:16 UTC

    Have script #1 add to PERL5LIB whatever it adds to @INC.