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

Is it possible to have two lib folders on a web site? My host doesn't have all the modules I need preinstalled so I have one lib folder for those.

They said I need to call a different folder for the Image::Magick module. So how can I call modules from TWO different places? They said it's istalled but I need to call the directory /usr/bin/.

Replies are listed 'Best First'.
Re: two lib folders
by Belgarion (Chaplain) on Dec 05, 2005 at 21:17 UTC

    I'm assuming you mean something like:

    use lib ('/path/to/your/lib');

    That would add /path/to/your/lib to your @INC path. Do a perldoc on lib to find out more information.

      Here's a link: lib
      Is this saying I could make multiple use libs?
      use lib "/path/to/1/"; use lib "/path/to/2/";

        Yes, or you could combine them into one list:

        use lib ('/path/to/1/', '/path/to/2/');

        Each time you do a use lib adds those directories in the list to the @INC array.

Re: two lib folders
by ercparker (Hermit) on Dec 05, 2005 at 21:48 UTC
    here is another variation:
    use lib qw( /usr/bin /another/path /and/another/path );
    Hope that helps
Re: two lib folders
by wazzuteke (Hermit) on Dec 05, 2005 at 22:55 UTC
    If you have access to the proper user on the server or the config file(s), and assuming you are running a Linux box, one thing I like to do is set my Perl library using environment variables. Sometimes, it's a little cleaner when you know every script/module will/might need to use it:
    shell:~>PERL5LIB='/usr/bin' shell:~>export PERL5LIB
    Hope that helps!

    ---hA||ta----
    print map{$_.' '}grep{/\w+/}@{[reverse(qw{Perl Code})]} or die while ( 'trying' );