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

 



mike_robb
Novice

Mar 30, 2001, 6:37 PM

Post #1 of 3 (142 views)
INC Can't Post

code like this adds this path:

unshift(@INC, "/home/sporum/public_html/cgi-bin/spt");

how would i include this path if it is up one directory.
can i just use a path of ".." ?

TIA :-)



rGeoffrey
User / Moderator

Mar 31, 2001, 12:17 PM

Post #2 of 3 (136 views)
Re: INC [In reply to] Can't Post

You are probably changing @INC so you can use a module.

But use is a compile time thing and will happen before unshift which is a run time thing. To avoid this you should put your line inside a BEGIN block...


Code
BEGIN { 
unshift(@INC, "/home/sporum/public_html/cgi-bin/spt");
}

But you could also do...


Code
use LIB "/home/sporum/public_html/cgi-bin/spt";


--
Sun Sep 9, 2001 - 1:46:40 GMT, a very special second in the epoch. How will you celebrate?


mike_robb
Novice

Mar 31, 2001, 1:57 PM

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

thanks for the quick reply.

yes I am trying to use modules that are in the paths specified. I see from your post that it is possible to use the INC or the use command - but in both choices it looks like it is necessary to supply the full path to the modules (or the path of the modules).

I am working on an open source project http://www.sporum.org and it has a lot of files & directories. I am trying to make it easier to install by limiting the amount of changes required by people when they try to install the tool.

Is it possible to specify paths relatively, or by module name only?

all files are in a set directory structure layout and are not going to change, but the location of the "root" directory of this tool set will from install to install.

perhaps there is a way to have just one file contain the paths and all other files pick up on this?

i'm not too sure exactly what i'm looking for - perhaps someone here will :)

thanks again.




 
 


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

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