in reply to Use lib() and require

Hi,
The perldoc says about lib:-

"This is a small simple module which simplifies the manipulation of @INC at compile time.
It is typically used to add extra directories to perl's search path so that later C<use> or C<require> statements will find modules which are not located on perl's default search path."

The @INC variable is set to look in the various places AND the current directory:
mine is set for these paths:-
/usr/libdata/perl/5.00503/mach ,br> /usr/libdata/perl/5.00503
/usr/local/lib/perl5/site_perl/5.005/i386freebsd
/usr/local/lib/perl5/site_perl/5.005
and .

so if I want to 'use'/'require' .pl progs in say /home/perl then I can specify that in the code as

use lib /home/perl; # note lib will take a list

then I can 'require' or 'use' anything in that directory.

Hope this helps some.

Cheers
Steve

Replies are listed 'Best First'.
Re: Re: Use lib() and require
by costas (Scribe) on Apr 09, 2001 at 12:19 UTC
    1)DO I need to use 'use lib' if i am requesting script in the CURRENT directory. In other words does @INC always include the path "."?
      If anyone happens to stumble on this, and still needs help...
      Unless @INC shows that it includes '.', don't assume that it does.
      perl -e 'print @INC;'

      --
      paul