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

Help - Newbie here. I need to changed the @INC array, not just for the current run-time. I installed 5.6.1 via RPM , and for some reason the @INC did not get updated. Thanks, David

Replies are listed 'Best First'.
Re: Newbie - Changing @INC
by jwest (Friar) on Aug 23, 2001 at 19:39 UTC
    It seems like you might be looking to change Perl's default @INC, which would take a re-compile.

    However, if you're looking for an answer like presented above, you might want to try:

    use lib qw(/path/to/add /another/path/to/add);

    Using lib is a more simple way of doing what has been suggested by those who have posted before me. It hides the details of the BEGIN block, but it is essentially the same.

    Hope this helps!

    --jwest

    -><- -><- -><- -><- -><-
    All things are Perfect
        To every last Flaw
        And bound in accord
             With Eris's Law
     - HBT; The Book of Advice, 1:7
    
Re: Newbie - Changing @INC
by Hofmator (Curate) on Aug 23, 2001 at 20:49 UTC

    Use the environment variable PERL5LIB, usually like this % PERL5LIB=$HOME/perllib; export PERL5LIB Watch out though, this does not work if you are running under perl -T, in that case you have to use lib explicitly as suggested elsewhere in this thread.

    -- Hofmator

Re: Newbie - Changing @INC
by Sifmole (Chaplain) on Aug 23, 2001 at 19:32 UTC
    One method of modifying @INC is as follows:
    BEGIN { unshift(@INC, 'the/path/you/want'); }
    It is important that you do it within a BEGIN block because all use statements are processed before the rest of the program; An exception to this are BEGIN blocks.
      Will this method perserve the new @INC after the program ends ?
        No. It will change it for just the run of the program.
Re: Newbie - Changing @INC
by LostS (Friar) on Aug 23, 2001 at 19:29 UTC
    Ummm... Are you calling any kind of Module in your script?? If so... Is that module installed??
      Multiple Scripts with Multiple modules