CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
@INC

 



yaronb
stranger

Oct 22, 2001, 9:04 AM

Post #1 of 5 (818 views)
@INC Can't Post

How is the @INC directory (directory for module files)list determined ? How can you change it manually ?

Thanks,
Yaron.



yapp
User

Oct 25, 2001, 10:29 AM

Post #2 of 5 (807 views)
Re: @INC [In reply to] Can't Post

I thought it was defined during compilation of the Perl interpreter.

This should do the trick in normal cases.
You maybe can pusp a new value into @INC, but that's more a hack.

So do:

Code
use lib '/a_total/new/searchpath';




S_Shrum
User

Oct 25, 2001, 3:50 PM

Post #3 of 5 (803 views)
Re: @INC [In reply to] Can't Post

I believe (not sure) that:


Code
use lib '...';

may overwrite the @INC with only that which you pass.

Another way that APPENDS the path to the @INC is:


Code
BEGIN { unshift(@INC, 'pathtolibrary'); }

...where 'pathtolibrary' is your path to the location of your library.

Sean Shrum
sean@shrum.net
www.shrum.net


rGeoffrey
User / Moderator

Oct 27, 2001, 12:30 PM

Post #4 of 5 (798 views)
Re: @INC [In reply to] Can't Post

Actually


Code
use lib 'pathtolibrary';

appends to the front of @INC and is precisely what would happen with


Code
BEGIN { unshift(@INC, 'pathtolibrary'); }

But the use lib version is the cleaner way to say it.

The other way to do it is to use the -I operator on the command line.



S_Shrum
User

Oct 27, 2001, 4:32 PM

Post #5 of 5 (795 views)
Re: @INC [In reply to] Can't Post

Thanks...I think I clean my scripts up with that (since I am in the process of doing cleanup anyway Wink).

Sean Shrum
sean@shrum.net
www.shrum.net

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives