Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Removing entries from @INC

by ikegami (Patriarch)
on Feb 24, 2022 at 19:33 UTC ( [id://11141621] : note . print w/replies, xml ) Need Help??


in reply to Removing entries from @INC

I want to set @INC to an exactly list of directories

eh? You've surely done something wrong along the way if you need to do this.

Why do you think you need to remove entries from @INC?

Replies are listed 'Best First'.
Re^2: Removing entries from @INC
by perlancar (Hermit) on Feb 25, 2022 at 01:19 UTC

    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.

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