Click here to get back home

modulespath via environment-variable ?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
modulespath via environment-variable ? Felix Drueke 02-21-2005
Get Chitika Premium
Posted by Felix Drueke on February 21, 2005, 2:19 am
Please log in for more thread options


Hi,

is it possible to specify an alternative modules-path via environment-
variable?

The reason I ask is:
we are developing a product that uses perl and some perlmodules.
We want that the modules are installed in the developers workspace
from the source-control-system and not host-wide in /usr/local/lib/perl5.
We want that the perlmodules are part of the product.

As we already have many perl-scripts I just want to be able to set
an environment-variable (in a "PERLHOME"-style) in order to tell all
of them that they should search in that path for modules.

Thanks for any hints,
Felix


Posted by Brian McCauley on February 21, 2005, 3:09 pm
Please log in for more thread options


Felix Drueke wrote:

> is it possible to specify an alternative modules-path via environment-
> variable?

Yes.

> Thanks for any hints,

The a list of environment variables that can effect Perl can be found in
the reference manual. Actually they are not quite all in one place but
searching for the string "ENVIRONMENT" in the table of contents will
find them quickly.



Posted by Big and Blue on February 22, 2005, 12:12 am
Please log in for more thread options


Felix Drueke wrote:
>
> is it possible to specify an alternative modules-path via environment-
> variable?

Yes, but there are other ways to do it too, and better ones.

> we are developing a product that uses perl and some perlmodules.
> We want that the modules are installed in the developers workspace
> from the source-control-system and not host-wide in /usr/local/lib/perl5.
> We want that the perlmodules are part of the product.

Then make them part of the product. Get the product to add:

use lib qw( dir-path1 dir-path2 etc );

at the beginning of each script.

> As we already have many perl-scripts I just want to be able to set
> an environment-variable (in a "PERLHOME"-style) in order to tell all
> of them that they should search in that path for modules.

However, if you do that in a global environment variable (PERL5LIB)
then *all* perl usage will start looking in those locations, which isn't
what you want.

You could also write a script interlude which execs the "real" perl,
having inserted relevant -Idir... options at the start of the argument
list. Then get the scripts to use this interlude in the #! line.


> Thanks for any hints,

Application settings go with an application, not the global system.



--
Just because I've written it doesn't mean that
either you or I have to believe it.



Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap