Then, every time perl is invoked, @INC is set as desired.

Actually, that's not quite always so. This was not what I expected:
C:\>perl -MMath::BigInt -le "print 'PERL5OPT: ' . $ENV{PERL5OPT};print + for @INC; " PERL5OPT: -MMy_INC /ajperznes/perl/localperl /ajperznes/perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32.0 /ajperznes/perl/lib/site_perl/5.32.0/x86_64-linux /ajperznes/perl/lib/site_perl/5.32.0 /ajperznes/perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32.0
I expected that command to fail because Math::BigInt does not exist in any of those @INC directories that are listed. (It exists only in one of my original @INC directories.)
I expected that command to do the same as the following one-liner (in which PERL5OPT is unset):
C:\>perl -MMy_INC -MMath::BigInt -le "print 'PERL5OPT: ' . $ENV{PERL5O +PT};print for @INC;" Can't locate Math/BigInt.pm in @INC (you may need to install the Math: +:BigInt module) (@INC contains: /ajperznes/perl/localperl /ajperznes/ +perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32.0 /ajperznes/pe +rl/lib/site_perl/5.32.0/x86_64-linux /ajperznes/perl/lib/site_perl/5. +32.0 /ajperznes/perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32 +.0). BEGIN failed--compilation aborted.
But instead it processed the -MMath::BigInt before it processed the -MMy_INC. That is, it does the same as:
C:\>perl -MMath::BigInt -MMy_INC -le "print 'PERL5OPT: ' . $ENV{PERL5O +PT};print for @INC;" PERL5OPT: /ajperznes/perl/localperl /ajperznes/perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32.0 /ajperznes/perl/lib/site_perl/5.32.0/x86_64-linux /ajperznes/perl/lib/site_perl/5.32.0 /ajperznes/perl/lib/5.32.0/x86_64-linux /ajperznes/perl/lib/5.32.0
Is it possible to have perl process the contents of PERL5OPT *before* any -M... command line switches are processed ?

UPDATE: I don't think this would be an issue for dirtdog because, IIUC, the directories in his original @INC don't exist anyway.

Cheers,
Rob

In reply to Re^2: @INC not reflecting correctly by syphilis
in thread @INC not reflecting correctly by dirtdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.