Question on perl/cgi paths - Perl

This is a discussion on Question on perl/cgi paths - Perl ; 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 ...

+ Reply to Thread
Results 1 to 6 of 6

Question on perl/cgi paths

  1. Default 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

  2. Default Re: Question on perl/cgi paths



    > 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

  3. Default Re: Question on perl/cgi paths

    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

  4. Default Re: Question on perl/cgi paths

    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

  5. Default Re: Question on perl/cgi paths

    In article <pan.2004.01.06.17.10.56.785809@omniforgetit.com>, Bill
    Davis <BillD@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.

  6. Default Re: Question on perl/cgi paths

    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 to Thread

Similar Threads

  1. question about paths/workspace
    By Application Development in forum Idl-pvwave
    Replies: 9
    Last Post: 12-05-2007, 08:02 PM
  2. Newbie paths question
    By Application Development in forum Adobe illustrator
    Replies: 3
    Last Post: 06-21-2007, 09:12 AM
  3. question about file paths...
    By Application Development in forum basic.visual
    Replies: 1
    Last Post: 03-16-2007, 04:57 PM
  4. Another Create Edit Paths Question
    By Application Development in forum Graphics
    Replies: 2
    Last Post: 02-02-2006, 08:53 AM
  5. Paths question
    By Application Development in forum Perl
    Replies: 5
    Last Post: 10-01-2003, 04:01 PM