Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Multiple Path in use lib

by gopalr (Priest)
on Jul 03, 2006 at 12:35 UTC ( #558980=perlquestion: print w/replies, xml ) Need Help??
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.


    "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 (Pilgrim) 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,


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://558980]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2018-06-20 18:21 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.