469,631 Members | 1,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Question on perl/cgi paths

I am just starting to play with CGI programs on a box with RH 9. Testing
to see if I had the stuff installed I used a very simple script like so...

#!/usr/bin/perl -w
use strict;
use CGI;

It told me that it couldn't find CGI.pm and sure enough, that apparently
doesn't come on the RedHat 9 distro. So I installed the latest version of
Perl (5.8.1, I think) and CGI.pm came with it.

But when I run the above test, I get the following...

Can't locate CGI.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0...
etc...etc

Perl -v gives the correct new version of 5.8.1, but the above seems to say
that I have a path variable somewhere that is pointing to the old version.
It is the @INC that I am hung up on. None of my books have a reference
to it and naturally the Perl website search function is down at the moment.
Neither do the man pages, or else I am not giving the right search args.

Anybody give me some insite on what the @INC is?

Thanks
Bill Davis
Jul 19 '05 #1
5 6001

Can't locate CGI.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0...
etc...etc


OK, lots of searching gets the answer that @INC is the variable that
contains the list of paths to search. No problem, since that is what I
thought it would be. And I finally found it in a book, also.

However, all of the advice on googling and the book says the same thing -
just change the variable to match your paths to your modules. Great. They
just left out one thing - where is the file (or variable) that is to be
changed?

The usual answer is to just recompile and install CGI.pm and that will set
the paths to the proper location. However, my usage of Linux is a
learning progress at the moment rather than a production usage, and I
would like to know the details of why rather than just fix it and go.

Bill Davis
Jul 19 '05 #2
Bill

Your script calls /usr/bin/perl for interpreting the script at line 1.
But is this the location of the new perl 5.8.1 version you installed?

To check where perl is located type the command :
which perl
in a Xterm. If this differs from the /usr/bin location use this
location in the fist line of your scripts.

Other wise change @INC as follows:
no lib qw(:All .); # will clear @INC
use lib qw( your path's space separated) ; # will set @INC to your
path's

Cheers

KArel
Jul 19 '05 #3
On Mon, 05 Jan 2004 05:37:02 -0800, Karel wrote:
Bill

Your script calls /usr/bin/perl for interpreting the script at line 1.
But is this the location of the new perl 5.8.1 version you installed?

To check where perl is located type the command :
which perl
in a Xterm. If this differs from the /usr/bin location use this
location in the fist line of your scripts.

Other wise change @INC as follows:
no lib qw(:All .); # will clear @INC
use lib qw( your path's space separated) ; # will set @INC to your
path's


Thanks. I got the problem fixed, but like I said, I am trying to
understand the process. I am still unsure where @INC resides, although I
can now change it all day long. I am afraid that I am an unreconstructed
empiricist - I like to be able to SEE the code that I am working on:)

Thanks
BD
Jul 19 '05 #4
In article <pa****************************@omniforgetit.com >, Bill
Davis <Bi***@omniforgetit.com> wrote:
On Mon, 05 Jan 2004 05:37:02 -0800, Karel wrote:
Bill

Your script calls /usr/bin/perl for interpreting the script at line 1.
But is this the location of the new perl 5.8.1 version you installed?

To check where perl is located type the command :
which perl
in a Xterm. If this differs from the /usr/bin location use this
location in the fist line of your scripts.

Other wise change @INC as follows:
no lib qw(:All .); # will clear @INC
use lib qw( your path's space separated) ; # will set @INC to your
path's


Thanks. I got the problem fixed, but like I said, I am trying to
understand the process. I am still unsure where @INC resides, although I
can now change it all day long. I am afraid that I am an unreconstructed
empiricist - I like to be able to SEE the code that I am working on:)

Thanks
BD


The @INC variable is set by the perl interpreter before your program
executes. Use "perl -V" (capital V) to see what it normally is. Try

perldoc -q 'How do I add a directory to my include path'

for ways to add libraries to @INC. However, you don't want to be
maintaining your own special @INC array value. Make sure you always use
the same perl program for installing modules that you use for running
programs, and the installer should put the modules in one of the
directories already in your @INC.

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
for better response.
Jul 19 '05 #5
O

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
for better response.

Thanks. I was wondering where everybody was. On a dialup that is maxed
out by the phone company at 26k, it is hard to sample enough groups to
find out where everyone is hanging out.

BD
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jim Rendant | last post: by
2 posts views Thread by Julie Warden | last post: by
5 posts views Thread by Johann C. Rocholl | last post: by
1 post views Thread by pitjpz | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.