Well, no luck with chatterbox, so I guess I ask it here.

When building perl (I'm actually installing with plenv), how do I remove curdir (i.e., ".") from the default @INC? I don't mean no lib "." or anything like that, I mean perl -V shouldn't show it at the bottom.

You can stop reading here unless you like other people's whining.

For some reason, I can't make DDG or any other search engine return anything except how to add things to @INC at run time. Is that really a thing people don't know how to do? It's in the FAQ for Wall's sake! If you want to *add* directories during Configure http://search.cpan.org/perldoc/INSTALL tells you all about it and a million other things. Yet not a word on *removing* directories.

Why is curdir even included in the default @INC in the first place? How often is your cwd a perl library root! I'm thinking... approximately never. It seems like a security risk to me. It definitely messes up plenv list-modules (i.e., ExtUtils::Installed->new->modules()), which now has to look through whatever your cwd is and all it's descendants for .packlist files. Even if you happen to be located in a directory with thousands of subdirectories and millions of files: "YTF is this list-modules command not returning instantly whenever I'm on my NAS NFS mount?!?" Even if you're in a project directory with multiple local::lib installs: "YTF is list-modules telling me every module in every project is installed, when none of them are installed at this level?!?" Even if you're in $HOME (where plenv lives): "YTF is list-modules telling me every module I've installed for *any* version of perl is installed for *every* version of perl I have?!?"

Ridiculous. Yet I can't find anyone else having this issue because search engines only want to tell me about adding to @INC at runtime. Sigh. I even looked through the Configure script and couldn't find anything about leaving out directories. Hopefully some monk knows the answer. Thanks!


In reply to Configuring default @INC by Thopilt

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.