Ask a Question related to PERL Modules, Design and Development.
-
rembremading #1
use lib
Is there a way to include several library paths with
use lib
at once, so that I can do something like
use lib $ENV{'PERL_LIBRARY_PATHS'};
The following seems not to work ...
@array = split(/ /$ENV{'PERL_LIBRARY_PATHS'});
foreach $array_item (@array){
use lib $array_item;
}
rembremading Guest
-
Thomas Wittek #2
Re: use lib
rembremading schrieb:
Try:> Is there a way to include several library paths with
> use lib
> at once,
unshift @INC, qw(/some/path /some/other/path);
You may want to put this into a BEGIN block:
BEGIN {
...
}
-Thomas
Thomas Wittek Guest
-
Dr.Ruud #3
Re: use lib
rembremading schreef:
See perldoc lib.> Is there a way to include several library paths with
>
> use lib
>
> at once, so that I can do something like
>
> use lib $ENV{'PERL_LIBRARY_PATHS'};
>
> The following seems not to work ...
>
> @array = split(/ /$ENV{'PERL_LIBRARY_PATHS'});
> foreach $array_item (@array){
> use lib $array_item;
> }
See perldoc -f split.
I doubt that
use lib split(' ', $ENV{'PERL_LIBRARY_PATHS'}) ;
will work, because the separator is likely ':', and there may be empty
list members.
--
Affijn, Ruud
"Gewoon is een tijger."
Dr.Ruud Guest
-
rembremading #4
Re: use lib
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{'PERL_LIBS'}); }
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{'PERL_LIBRARY_PATHS'};
>>
>> The following seems not to work ...
>>
>> @array = split(/ /$ENV{'PERL_LIBRARY_PATHS'});
>> foreach $array_item (@array){
>> use lib $array_item;
>> }
> See perldoc lib.
>
> See perldoc -f split.
>
>
> I doubt that
>
> use lib split(' ', $ENV{'PERL_LIBRARY_PATHS'}) ;
>
> will work, because the separator is likely ':', and there may be empty
> list members.
>rembremading Guest
-
Brian McCauley #5
Re: use lib
rembremading wrote upside-down:
As would> However I found out that
>
> BEGIN { use lib split(':', $ENV{'PERL_LIBS'}); }
>
> works.
BEGIN { BEGIN { use lib split(':', $ENV{'PERL_LIBS'}); } }
or
BEGIN { BEGIN { BEGIN { use lib split(':', $ENV{'PERL_LIBS'}); } } }
or simply
use lib split(':', $ENV{'PERL_LIBS'});
Brian McCauley Guest
-
John Bokma #6
Re: use lib
rembremading <rembremading@gmx.net> wrote:
Why don't you user PERL5_LIB, which IIRC can handle more then one path.> Is there a way to include several library paths with
> use lib
> at once, so that I can do something like
>
> use lib $ENV{'PERL_LIBRARY_PATHS'};
>
> The following seems not to work ...
>
> @array = split(/ /$ENV{'PERL_LIBRARY_PATHS'});
> foreach $array_item (@array){
> use lib $array_item;
> }
--
John Bokma Freelance software developer
&
Experienced Perl programmer: [url]http://castleamber.com/[/url]
John Bokma Guest



Reply With Quote

