Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Question on perl/cgi paths

Reply
Thread Tools

Question on perl/cgi paths

 
 
Bill Davis
Guest
Posts: n/a
 
      01-04-2004
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
 
Reply With Quote
 
 
 
 
Bill Davis
Guest
Posts: n/a
 
      01-04-2004


> 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
 
Reply With Quote
 
 
 
 
Karel
Guest
Posts: n/a
 
      01-05-2004
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
 
Reply With Quote
 
Bill Davis
Guest
Posts: n/a
 
      01-06-2004
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
 
Reply With Quote
 
Jim Gibson
Guest
Posts: n/a
 
      01-06-2004
In article < >, Bill
Davis <> 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.
 
Reply With Quote
 
Bill Davis
Guest
Posts: n/a
 
      01-07-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paths, gentleman, paths Ohad Lutzky Ruby 2 11-07-2006 02:15 AM
Question regarding redundant paths in multi agency environment. ec Cisco 1 10-30-2004 12:25 AM
General question about IP packets and diverisified paths BitBucket Cisco 2 11-08-2003 07:43 PM
Paths question Jim Rendant Perl 5 10-01-2003 09:01 PM
Convert between Windows style paths and POSIX style paths Noah Python 5 07-11-2003 09:25 PM



Advertisments