Click here to get back home

use lib

 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
use lib rembremading 06-09-2006
|--> Re: use lib Thomas Wittek06-09-2006
| ---> Re: use lib rembremading06-09-2006
|   `--> Re: use lib Brian McCauley06-09-2006
`--> Re: use lib John Bokma06-09-2006
Get Chitika Premium
Posted by rembremading on June 9, 2006, 6:09 am
Please log in for more thread options


Is there a way to include several library paths with
use lib
at once, so that I can do something like

use lib $ENV;

The following seems not to work ...

@array = split(/ /$ENV);
foreach $array_item (@array){
use lib $array_item;
}


Posted by Thomas Wittek on June 9, 2006, 6:22 am
Please log in for more thread options


rembremading schrieb:
> Is there a way to include several library paths with
> use lib
> at once,
Try:

unshift @INC, qw(/some/path /some/other/path);

You may want to put this into a BEGIN block:

BEGIN {
...
}

-Thomas

Posted by Dr.Ruud on June 9, 2006, 6:27 am
Please log in for more thread options


rembremading schreef:

> Is there a way to include several library paths with
>
> use lib
>
> at once, so that I can do something like
>
> use lib $ENV;
>
> The following seems not to work ...
>
> @array = split(/ /$ENV);
> foreach $array_item (@array){
> use lib $array_item;
> }

See perldoc lib.

See perldoc -f split.


I doubt that

use lib split(' ', $ENV) ;

will work, because the separator is likely ':', and there may be empty
list members.

--
Affijn, Ruud

"Gewoon is een tijger."



Posted by rembremading on June 9, 2006, 7:24 am
Please log in for more thread options


I export the PERL_LIBRARY_PATHS environment variable by myself, so that I
can have the paths separated by whatever I like. But it doesn't work
anyway.

However I found out that

BEGIN { use lib split(':', $ENV); }

works.

Dr.Ruud wrote:

> rembremading schreef:
>
>> Is there a way to include several library paths with
>>
>> use lib
>>
>> at once, so that I can do something like
>>
>> use lib $ENV;
>>
>> The following seems not to work ...
>>
>> @array = split(/ /$ENV);
>> foreach $array_item (@array){
>> use lib $array_item;
>> }
>
> See perldoc lib.
>
> See perldoc -f split.
>
>
> I doubt that
>
> use lib split(' ', $ENV) ;
>
> will work, because the separator is likely ':', and there may be empty
> list members.
>


Posted by Brian McCauley on June 9, 2006, 8:23 am
Please log in for more thread options


rembremading wrote upside-down:

> However I found out that
>
> BEGIN { use lib split(':', $ENV); }
>
> works.

As would

BEGIN { BEGIN { use lib split(':', $ENV); } }

or

BEGIN { BEGIN { BEGIN { use lib split(':', $ENV); } } }

or simply

use lib split(':', $ENV);



Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap