CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Add a directory to @INC on the installation level

 



zatlas1
User

Jan 13, 2016, 10:58 AM

Post #1 of 4 (2120 views)
Add a directory to @INC on the installation level Can't Post

I work in a multi-server environment. Each server may have its own Perl installation (worse, they have several installations to support old levels of Perl... don't ask :(
Now, there is a service which is shared by all servers and there is a dedicated shared mount for that server. Let's assume that I could have an open-to-all directory named:
/servicename/perl/lib or something similar, and let's assume that I could install all perl packages related to that service on that directory. How would I add that directory to the @INC on the install level (i.e. users should have all packages on that directory available too them without any 'use lib', '-I', etc. The user should just say 'use COMMONSERVICE::Specificpackage;' and be done with?
Thanks
ZA


FishMonger
Veteran / Moderator

Jan 13, 2016, 4:51 PM

Post #2 of 4 (2109 views)
Re: [zatlas1] Add a directory to @INC on the installation level [In reply to] Can't Post

You can add user specified paths to the @INC array when building/compiling perl. That is done by setting the configuration option otherlibdirs.

http://search.cpan.org/~shay/perl-5.22.1/INSTALL#otherlibdirs

If perl is already built/installed, you can put the paths in the PERL5LIB (or PERLLIB) environment variable and they will be pre-pended to the @INC array.


zatlas1
User

Jan 13, 2016, 5:24 PM

Post #3 of 4 (2101 views)
Re: [FishMonger] Add a directory to @INC on the installation level [In reply to] Can't Post

Thank you.
I've realized that short of re-installing on all machines, I'll have to either set PERL5LIB as a standard or require the user to use -I switch. It is not the easiest environment to deal with.
ZA


FishMonger
Veteran / Moderator

Jan 13, 2016, 5:33 PM

Post #4 of 4 (2098 views)
Re: [zatlas1] Add a directory to @INC on the installation level [In reply to] Can't Post

I'd use a use lib statement in the scripts instead of the -I switch.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives