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

I had a script that was working until recently and I discovered it was because my script requires an older version of the module that my web host just updated.

I had to install it into my own LIB folder before but they went ahead and installed it on the root as well.. now my script doesn't work.

Is there any way to tell the script to use MY lib folder module instead of find it on the root? I think it'd make things work again.

Replies are listed 'Best First'.
Re: specifying which perl module to use
by friedo (Prior) on Sep 16, 2005 at 16:33 UTC
    You can use lib, which will push your home directory onto the beginning of @INC. Since @INC is searched in order, Perl will find your locally installed module before searching the default installation directories.
      I think you need to be more specific.

      use lib;

      doesn't appear to do anything. Perhaps you meant

      use lib '~';

      Update suggested by tinita: better than '~'

      use lib $ENV{HOME};

      or something equivalent instead?

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

Re: specifying which perl module to use
by cbrandtbuffalo (Deacon) on Sep 16, 2005 at 19:39 UTC
    Or to be even more specific, I've needed to go so far as to do all of the following, depending on the module:
    use lib '/path/to/my/home/perl/lib'; use lib '/path/to/my/home/perl/lib/sun4-solaris'; use lib '/path/to/my/home/perl/lib/site_perl/5.8.6/sun4-solaris';
    You get the idea. It depends on where the module is installed, so watch the location when you run the install and grab the 'use lib' statement from there.

    Also, be careful with other modules you install. These will put all locally installed modules in the path first. I've burned myself by having more than one locally installed module and using them when I really wanted the system version for something.