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

I'm looking to add some directories (outside of my scripts at the system) to the @INC variable used by Perl. I have additional directories I want to store modules in. Can I (how can I) add directories that will be added to @INC from outside a script and what's the easiest/best way to add to the @INC variable from within a script? Thanks monks for any help you can give.

Replies are listed 'Best First'.
Re: Adding to @INC
by moritz (Cardinal) on Nov 04, 2009 at 19:03 UTC
    perlrun describes various methods such as the -I option and the PERL5LIB and other env variables.
    Perl 6 - links to (nearly) everything that is Perl 6.
Re: Adding to @INC
by kennethk (Abbot) on Nov 04, 2009 at 19:02 UTC
    This is discussed here in perlvar. The short of it is using -I on the command line (perlrun) or pushing on to the array at runtime (with some additional care depending on what you are INCluding, see require).
      ... pushing on to the array at runtime ...
      The lib pragma discussed with  @INC in perlvar does this very conveniently.
Re: Adding to @INC
by toolic (Bishop) on Nov 04, 2009 at 19:04 UTC