On 4/14/06, Randy W. Sims <[EMAIL PROTECTED]> wrote:
> chen li wrote:
> > Hi all,
> >
> > Thank you all for reply my post in advance.
> >
> > I install in new module like this:
> > c:/perl/local/new.pm.
> >
> > How should tell the perl to look at it in addition to
> > the default paths?
>
> Set the environment variable PERL5LIB to the additional paths.
>
> On the command line: `set PERL5LIB=C:\perl\local`
>
> or in the system control panel applet (hold <Windows> key and press
> <break>), select advanced tab, hit the "Environment Variables" button.
> Then create a new system or user variable.
>
> I have a number of perls on my machines, and switch back and forth by
> manipulating the PATH and PERL5LIB all the time. This is the easiest way
> to do it.
>
> ( You can also do it by setting various entries in the registry, see
> <perl-src>\win32\win32.c in functions win32_get_privlib(),
> win32_get_xlib() )
>
> Randy.

Be very careful with this. It's convenient for testing, but it's
non-portable. Not only is it platform dependent, it's machine and even
user dependent. On unix, it will only work for your user, in shells
where you've set PERL5LIB. Depending on where you set the variable--on
the command line, in .login, .profile, or .*rc--using PERL5LIB won't
even work for every invocation you run as yourself. It won't work for
other users, and it won't work on other machines. It's also often
difficult to manage if you're using multiple directories with
different module versions; you have to constantly check and make sure
the shell initialized with the proper PERL5LIB value.

The situation on Windows is roughly the same, although if you use the
control panel instead of the command line, everything you run as
yourself should get the variable.

PERL5LIB is a quick and dirty approach to testing when you want to see
how a particular script will function in a different environment--for
instance to see if a new Perl installation will break an old
script--but it's no substitute for 'use lib' which is portable,
obvious, and maintainable. Have a little pity on whoever will have to
maintin the scripts later.

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to