in reply to Re^2: Win32 @INC behavior
in thread Win32 @INC behavior

@INC is the result of all perllib additions that have been made by perl upon startup. It is not fixed at all. Although there is a portion of it that is fixed at compile time. The @INC is a combination of compile time settings, PERLLIB environment variable, perl command line -I parameters and use lib statements.

For example on linux, if you do:

PERLLIB=envbar perl -I cmdfoo -V -e "use lib ('usebaz');"

You will see the resulting @INC :

@INC: usebaz cmdfoo envbar /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .

There appears to be an order of precidence here too. use lib is first, -I option is second, PERLLIB is third and compiled settings is fourth.

Update: added use lib to the example.

Hazah! I'm Employed! But this place sucks

Replies are listed 'Best First'.
Re^4: Win32 @INC behavior
by richz (Beadle) on Nov 17, 2005 at 00:41 UTC
    Yeah I guess I meant fixed if not modified using environment variable, command line option, etc. The location of the perl executable seems to affect the @INC variable and I think a reply further down in this thread is a convincing reason. Thanks.