in reply to ADD PATH TO @INC

A related question: I'd like to add a directory to @INC globally, without changing my programs.

Can it be done using an environment variable in Win?

Or perhaps some other way?

Larry

  • Comment on Can @INC be modified using environment variables in Win?

Replies are listed 'Best First'.
Re: Can @INC be modified using environment variables in Win?
by perchance (Monk) on Jun 19, 2001 at 12:00 UTC
    Hi,

    The 'set' command will work for a given cmd window (or always, if you run it in a batch file or 'system' call at the beginning of the script).

    If you want to set it permanently, go to:
    control panel->system->advanced->environment variables
    and set PERL5LIB there. (This is on Win2K, but if I recall it's the same on NT4)

    - perchance

Re: Can @INC be modified using environment variables in Win?
by John M. Dlugosz (Monsignor) on Jun 19, 2001 at 02:10 UTC
    In Windows, the starting path is stored in the registry, but not really documented as to where -- you can find it if you look, though. In general, you can use an environment variable (PERL5LIB I think) which is combined with that starting path.
      John,

      Thanks! I actually just found this in the Perl Cookbook.

      set PERL5LIB=e:\whatever\whateverworks as advertised.

      No, in Win32 Perl, the starting value of @INC is computed based on the path to the running perl.exe. Some versions of Win32 Perl also look in the Registry.

              - tye (but my friends call me "Tye")
        The current shipment of ActiveState (build 626) looks in HKLM\Software\Perl for values named PERL5OPT, PERL5LIB, PERLLIB, lib-5.6.1, lib, sitelib-5.6.1, and sitelib.

        It also opens HKCU\Software\Perl many times, but doesn't check any values contained in it. Perhaps it only checks the Current User if it found something under Local Machine, but that seems a strange thing to do. It could just be buggy.

        It does look at the location of the currently-run exe file, too, if it's in a /bin/ subdirectory (but not otherwise) and if the generated names actually exist.

        —John