Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Basic - Perl5lib

by Khen1950fx (Canon)
on Oct 27, 2010 at 23:58 UTC ( [id://867871]=note: print w/replies, xml ) Need Help??


in reply to Basic - Perl5lib

PERL5LIB looks for modules in a private directory, for example, a development directory. If you want to use the modules in the development directory, then you can tell Perl to add the development directory to the front of @INC like this:

 export PERL5LIB=/home/uid/lib/perl5

Replies are listed 'Best First'.
Re^2: Basic - Perl5lib
by aquarium (Curate) on Oct 28, 2010 at 02:23 UTC
    ..and typically you'd set that environment variable so that all your processes/scripts had access to that additional module directory. otherwise just add an additional module directory directly in a perl script by pushing it onto @INC in a begin section. example for modules in specified directory and/or current directory
    BEGIN { $my_module_dir = '~/myperl_modules/`; push(@INC, ('.',"$my_module_dir")); } use mymodule; ...
    oracle installs (and embedded) perl and it's own set of modules, and sets perl5lib. so not a good idea to modify perl5lib on oracle systems unless you really know what you're doing.
    the hardest line to type correctly is: stty erase ^H
      The more common way to add to @INC from within your program is with use lib. The following is equivalent to (more concise than) the code above:
      use lib qw( . ~/myperl_modules/ ); use mymodule;
      ...except that use lib puts the extra dirs at the start of @INC (giving them precedence over system modules, which is normally what you want) while your use of push puts them at the end (giving system modules precedence, which is normally not what you want).

      Thanks for your replies. How can I set the PERL5LIB environment variable if I don't have one?

      If I do manage to find my missing PERL5LIB, is it shared by all my Perl installations?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://867871]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2025-06-16 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.