Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Installing modules locally

by aspeer (Initiate)
on Jul 29, 2006 at 06:10 UTC ( [id://564498]=note: print w/replies, xml ) Need Help??


in reply to Installing modules locally

I had this problem when installing modules locally also. I wrote a small 'helper' module that I include from the command line, or in my scripts, which customises @INC for me by reading in a config file that contains a list of all directories I want added.

The module looks for a file /etc/perl5lib.pm (or %windir%/perl5lib.pm) and reads in a array ref of directories from that file.

It then massages @INC to include all relevant directories under those paths using hints from Config.pm about sitelib/privlib/archlib/vendorlib etc. without them needing to be explicitly declared.

You can download the file from here - it is too hackish to upload to CPAN as a module.

The /etc/perl5lib.pm file is in Data::Dumper format - it looks like this:

$VAR1=[ '/opt/project1', '/opt/project2', .. ];

Then to include all the above directories *and* any relevant vendorlib/sitelib/archlib etc directories under them in which modules may have been installed, run

perl -I/path/to/perl5lib.pm -Mperl5lib script.pl

Or include in your script:

#!/bin/perl use lib '/path/to/perl5lib.pm', use perl5lib

I did not know about the perl Makefile.PL PREFIX=<path> LIB=<path> option mentioned above though - that looks like a better idea if the modules are not already installed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://564498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-18 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found