Modification of @INC


#1

Hi, I’m using bash and trying to install some custom modules on my account.

What’s the easiest way to go about this? Do I even need to modify @INC? Is this okay to do on my Dreamhost account?

Also, what’s the correct way to modify @INC in bash. I can’t seem to remember at the moment and Google isn’t much help.


#2

Are you talking about the shell, or Perl? Because @INC is a Perl convention AFAIK, and if bash doesn’t have it too, no wonder your search is fruitless.

In Perl, you modify @INC at runtime as below:

:cool: Perl / MySQL / HTML CSS


#3

Well I’m having trouble getting some modules to install because they depend on other modules present, which are actually installed in my custom perllib folder, but they aren’t getting properly recognized.

I figured out in bash that you can use:
export PERL5LIB=~/.perllib

This works during a temporary session but once I log out of bash, Dreamhost resets @INC.

I’m only having trouble getting one module to install, YAML. Maybe I could just get a Dreamhost admin to install it for me :slight_smile:

Ultimately I’m trying to get Net::Delicious to run on my account, but to no avail at the moment.


#4

[quote]I figured out in bash that you can use:
export PERL5LIB=~/.perllib

This works during a temporary session but once I log out of bash, Dreamhost resets @INC.
[/quote]
I’m not following what you are trying to do. Dreamhost does not reset @INC, its just that @INC is builtin (when the perl executable was compiled) and then when the perl executable runs, it checks environment variables OR the lib pragma.

Are you getting errors when trying to execute the perl script as CGI? If so, just open the script, and add

use lib '/home/username/.perllib';For example, I have ~/lib/Company, and in my CGI scripts start with:

use lib '/home/username/lib'; use Company; use Company::Config; use Company::Layout;Here is what the perl documentation says:

[quote]The array @INC contains the list of places that the do EXPR, require, or use constructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl, followed by ``.’’, to represent the current directory. If you need to modify this at runtime, you should use the use lib pragma to get the machine-dependent library properly loaded also:

use lib ‘/mypath/libdir/’;
use SomeMod;[/quote]

:cool: Perl / MySQL / HTML+CSS