Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default 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

  2. #2

    Default Re: use lib

    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
    Thomas Wittek Guest

  3. #3

    Default Re: use lib

    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.

    --
    Affijn, Ruud

    "Gewoon is een tijger."


    Dr.Ruud Guest

  4. #4

    Default 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

  5. #5

    Default Re: use lib

    rembremading wrote upside-down:
    > However I found out that
    >
    > BEGIN { use lib split(':', $ENV{'PERL_LIBS'}); }
    >
    > works.
    As would

    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

  6. #6

    Default Re: use lib

    rembremading <rembremading@gmx.net> wrote:
    > 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;
    > }
    Why don't you user PERL5_LIB, which IIRC can handle more then one path.

    --
    John Bokma Freelance software developer
    &
    Experienced Perl programmer: [url]http://castleamber.com/[/url]
    John Bokma Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139