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: Beginner:
Cant push path into @INC

 



newbie
Deleted

Apr 19, 2000, 10:19 PM

Post #1 of 11 (2528 views)
Cant push path into @INC Can't Post

help!

Im trying to push stuff into @INC. but the way im doing it, isnt working

I tried:
#!/usr/bin/perl

push(@INC, '/www/site/lib');


Cure
User

Apr 19, 2000, 10:27 PM

Post #2 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

Hi

It's not working becuase your pushing the contents into the @INC at run-time instead of compile time

This will work for you-->
#!/usr/bin/perl

BEGIN{
push @INC, '/www/site/lib';
}


I would recommend using the lib module to maipulate the @INC array.

example, this will work for you-->

#!/usr/bin/perl

use lib '/www/site/lib';


Cure


locdog
Deleted

Apr 27, 2000, 4:39 PM

Post #3 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

I agree with cure the best
way is to use the

use lib "path";

however I also believe you still need
to have a

require("module");

after the use lib if there is a module
being used.

Locdog


Cure
User

Apr 27, 2000, 4:53 PM

Post #4 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

Hi

to use a module do this at the top of your script.

use module;


Cure


jumaru
Deleted

Apr 27, 2000, 5:23 PM

Post #5 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

Cure :
when I write this:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


#!/usr/bin/perl

BEGIN{
push @INC, '/www/site/lib';
}
</pre><HR></BLOCKQUOTE>
in the the directory /www/site/lib I must have "module.pm" ??
after this I can write:
use module;

right ?



Cure
User

Apr 27, 2000, 5:31 PM

Post #6 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

Yes


Cure


jumaru
Deleted

Apr 27, 2000, 6:15 PM

Post #7 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

sorry Cure but it doesn't work for me I have:
Can't locate loadable object for module GD in @INC.....


Cure
User

Apr 27, 2000, 6:31 PM

Post #8 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

your doing it right, but whatever module your using --> your not using it right or the module depends on other modules.


Cure


jumaru
Deleted

Apr 27, 2000, 7:00 PM

Post #9 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

And what about makefile.pl and its installation ??
it doesn't need installation ??


Cure
User

Apr 27, 2000, 7:11 PM

Post #10 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

You need to use another module --> the GD.pm module needs to be install by your administrator because some modules require compiled components--> thats why your getting that error.


Cure

[This message has been edited by Cure (edited 04-27-2000).]


jumaru
Deleted

Apr 27, 2000, 7:16 PM

Post #11 of 11 (2528 views)
Re: Cant push path into @INC [In reply to] Can't Post

Okay
thanks

 
 


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

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