Most versions of Perl have a list of directories compiled into the executable. This list is determined at configuration time. Win32 Perl used to have this but also added to this list at run time. Recent versions of Win32 Perl only compute the directories to list in @INC at run time.

Win32 Perl asks the operating system for the full path name of the its executable. It then strips off the file name (probably "perl.exe"). Then it strips of "/bin/" (and perhaps a directory name containing version information, depending on how that copy of Perl was configured when it was compiled). That gives it the base directory. Then it puts into @INC several copies of that base directory path with different subdirectories appended to it. For example, common versions of Perl for Win32 append "lib" and "site/lib" (but you could also have version-specific and/or platform-specific library subdirectories separate from those, again, depending on how that copy of perl was configured when it was compiled).

Next, some versions of Perl will look for a value in the Win32 Registry for a list of additional directories to stuff into @INC. Also, "." is put into @INC as the last entry.

Finally, all of the standard tricks kick in to add even more directories to @INC:

Note that you probably would have gotten a good answer to this question a lot sooner if you hadn't asked for a reply "asap". We are all volunteers here and do this mostly for the enjoyment of it so, whether you say "kindly" or not, asking for something "asap" just takes some of the fun out of it for many people and so reduces the odds of you getting a good answer quickly. If this seems unfair to you, I kindly offer a full refund of the purchase price. (:

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Location of @INC in win2000 by tye
in thread Location of @INC in win2000 by athar-qadri

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.