http://www.perlmonks.org?node_id=558980

gopalr has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Can we use multiple path in use lib '<path>'.

If yes, please let me know how.

Thanks in Advance,
Gopal R.

Replies are listed 'Best First'.
Re: Multiple Path in use lib
by davorg (Chancellor) on Jul 03, 2006 at 12:41 UTC

    The documentation for the lib pragma says this:

    use lib LIST;

    and this:

    The parameters to use lib are added to the start of the perl search path.

    (Note the plural "parameters")

    From that we can assume that we can pass a list of directories to use lib and it will do what we expect.

    use lib qw(/path/to/one/library /path/to/another);

    Of course, multiple calls to use lib work too.

    use lib '/path/to/one/library'; use lib '/path/to/another';

    It's always well worth checking the documentation for answers to questions like this.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Multiple Path in use lib
by Joost (Canon) on Jul 03, 2006 at 12:41 UTC
Re: Multiple Path in use lib
by davidrw (Prior) on Jul 03, 2006 at 15:09 UTC
Re: Multiple Path in use lib
by Ieronim (Friar) on Jul 03, 2006 at 16:47 UTC
    BTW, but a little off-topic
    if you often need to use the same "use lib DIRS" directive, create an environment variable PERL5LIB containing directory names separated by a colon or semicolon (see perlrun for details) and forget about typing it :)
Re: Multiple Path in use lib
by madtoperl (Hermit) on Jul 03, 2006 at 12:52 UTC
    Hi Gopal,

    Yes,ofcourse you can include.If you want to include more than one path you have to use use lib qw(<path1> <path2> .. <pathn>)

    Thanks and Regards,

    madtoperl.