cahook has asked for the wisdom of the Perl Monks concerning the following question:

I would like to know how to change the @INC file for everyone who uses the perl on our server. Is there a way to add another path to it? c:\perl\lib c:\perl\site\lib I would like to add c:\our_priv_lib so that anyone who uses perl can get automatic access to a central lib repository that is generic for us.

Replies are listed 'Best First'.
Re: Changing @INC
by Corion (Patriarch) on Jul 09, 2007 at 19:20 UTC

    Just set $ENV{PERLLIB} or $ENV{PERL5LIB} for everybody in their profile. Also see perlrun.

      Also from perlrun
      -f

      Disable executing $Config{sitelib}/sitecustomize.pl at startup.

      Perl can be built so that it by default will try to execute $Config{sitelib}/sitecustomize.pl at startup. This is a hook that allows the sysadmin to customize how perl behaves. It can for instance be used to add entries to the @INC array to make perl find modules in non-standard locations.
      - Miller
Re: Changing @INC
by ikegami (Patriarch) on Jul 09, 2007 at 19:18 UTC
    It is my understanding that the list for @INC is created when perl is compiled, so adding a path to @INC globally would have to be done when compiling perl.
Re: Changing @INC
by sago (Scribe) on Jul 10, 2007 at 07:21 UTC

    The following two methods may be used to append to Perl's @INC array:

    1. Add the directory to the PERL5LIB environment variable.

    2. Add use lib 'directory'; in your Perl script.